text
stringlengths 1
22.8M
|
|---|
```html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "path_to_url">
<html xmlns="path_to_url"><head>
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Get data - - Atmel EDBG-based Tools Protocols</title><meta content="DocBook XSL Stylesheets V1.78.1" name="generator" /><link rel="home" href="index.html" title="Atmel EDBG-based Tools Protocols" /><link rel="up" href="section_serial_trace.html" title="Serial trace commands" /><link rel="prev" href="ch02s03s05.html" title="Stop" /><link rel="next" href="ch02s03s07.html" title="Get status" /><meta content="Get data" name="Section-title" /><script type="text/javascript">
//The id for tree cookie
var treeCookieId = "treeview-10619";
var language = "en";
var w = new Object();
//Localization
txt_filesfound = 'Results';
txt_enter_at_least_1_char = "You must enter at least one character.";
txt_browser_not_supported = "JavaScript is disabled on your browser. Please enable JavaScript to enjoy all the features of this site.";
txt_please_wait = "Please wait. Search in progress...";
txt_results_for = "Results for: ";
</script><link type="image/x-icon" href="../favicon.ico" rel="shortcut icon" /><link href="../common/css/positioning.css" type="text/css" rel="stylesheet" /><link href="../common/jquery/theme-redmond/jquery-ui-1.8.2.custom.css" type="text/css" rel="stylesheet" /><link href="../common/jquery/treeview/jquery.treeview.css" type="text/css" rel="stylesheet" /><style type="text/css">
#noscript{
font-weight:bold;
background-color:#55AA55;
font-weight:bold;
height:25spx;
z-index:3000;
top:0px;
width:100%;
position:relative;
border-bottom:solid 5px black;
text-align:center;
color:white;
}
input{
margin-bottom:5px;
margin-top:2px;
}
.folder{
display:block;
height:22px;
padding-left:20px;
background:transparent url(../common/jquery/treeview/images/folder.gif) 0 0px no-repeat;
}
.dochome{
display:block;
margin:10px 0 0 0;
padding-left:20px;
background:transparent url(../common/images/Library.png) 0 0px no-repeat;
}
.root{
display:block;
margin:10px 0 0 2px;
padding-left:20px;
background:transparent url(../common/images/Book_Open.png) 0 0px no-repeat;
}
.dochome a,
.root a {
text-decoration:none;
font-size:12px;
color:#517291;
}
span.contentsTab{
padding-left:20px;
background:url(../common/images/toc-icon.png) no-repeat 0 center;
}
span.searchTab{
padding-left:20px;
background:url(../common/images/search-icon.png) no-repeat 0 center;
}
/* Overide jquery treeview's defaults for ul. */
.treeview ul{
background-color:transparent;
margin-top:4px;
}
#webhelp-currentid{
background-color:#D8D8D8 !important;
}
.treeview .hover{
color:black;
}
.filetree li span a{
text-decoration:none;
font-size:12px;
color:#517291;
}
.filetree span.file {
background: url(../common/images/Document_Text.png) 0 0 no-repeat;
}
/* Override jquery-ui's default css customizations. These are supposed to take precedence over those.*/
.ui-widget-content{
border:0px;
background:none;
color:none;
}
.ui-widget-header{
color:#e9e8e9;
border-left:1px solid #e5e5e5;
border-right:1px solid #e5e5e5;
border-bottom:1px solid #bbc4c5;
border-top:4px solid #e5e5e5;
border:medium none;
background:#F4F4F4; /* old browsers */
background:-moz-linear-gradient(top, #F4F4F4 0%, #E6E4E5 100%); /* firefox */
background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #F4F4F4), color-stop(100%, #E6E4E5)); /* webkit */
font-weight:none;
}
.ui-widget-header a{
color:none;
}
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default{
border:none;
background:none;
font-weight:none;
color:none;
}
.ui-state-default a,
.ui-state-default a:link,
.ui-state-default a:visited{
color:black;
text-decoration:none;
}
.ui-state-hover,
.ui-widget-content .ui-state-hover,
.ui-widget-header .ui-state-hover,
.ui-state-focus,
.ui-widget-content .ui-state-focus,
.ui-widget-header .ui-state-focus{
border:none;
background:none;
font-weight:none;
color:none;
}
.ui-state-active,
.ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active{
border:none;
background:none;
font-weight:none;
color:none;
}
.ui-state-active a,
.ui-state-active a:link,
.ui-state-active a:visited{
color:black;
text-decoration:none;
background:#C6C6C6; /* old browsers */
background:-moz-linear-gradient(top, #C6C6C6 0%, #D8D8D8 100%); /* firefox */
background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #C6C6C6), color-stop(100%, #D8D8D8)); /* webkit */
-webkit-border-radius:15px;
-moz-border-radius:10px;
border:1px solid #f1f1f1;
}
.ui-corner-all{
border-radius:0 0 0 0;
}
.ui-tabs{
padding:.2em;
}
.ui-tabs .ui-tabs-panel {
padding-top: 6px;
}
.ui-tabs .ui-tabs-nav li{
top:0px;
margin:-2px 0 1px;
text-transform:uppercase;
font-size:10.5px;
}
.ui-tabs .ui-tabs-nav li a{
padding:.25em 2em .25em 1em;
margin:.5em;
text-shadow:0 1px 0 rgba(255, 255, 255, .5);
}
/**
* Basic Layout Theme
*
* This theme uses the default layout class-names for all classes
* Add any 'custom class-names', from options: paneClass, resizerClass, togglerClass
*/
.ui-layout-resizer{ /* all 'resizer-bars' */
background:#DDD;
top:100px
}
.ui-layout-toggler{ /* all 'toggler-buttons' */
background:#AAA;
}
</style><!--[if IE]>
<link rel="stylesheet" type="text/css" href="../common/css/ie.css"/>
<![endif]--><script src="../common/browserDetect.js" type="text/javascript"><!----></script><script src="../common/jquery/jquery-1.7.2.min.js" type="text/javascript"><!----></script><script src="../common/jquery/jquery.ui.all.js" type="text/javascript"><!----></script><script src="../common/jquery/jquery.cookie.js" type="text/javascript"><!----></script><script src="../common/jquery/treeview/jquery.treeview.min.js" type="text/javascript"><!----></script><script src="../common/jquery/layout/jquery.layout.js" type="text/javascript"><!----></script><script src="search/l10n.js" type="text/javascript"><!----></script><script src="search/htmlFileInfoList.js" type="text/javascript"><!----></script><script src="search/nwSearchFnt.js" type="text/javascript"><!----></script><script src="search/stemmers/en_stemmer.js" type="text/javascript" /><script src="search/index-1.js" type="text/javascript"><!----></script><script src="search/index-2.js" type="text/javascript"><!----></script><script src="search/index-3.js" type="text/javascript"><!----></script><meta name="date" content="" /><meta name="dc.date.created" content="" /><link rel="stylesheet" type="text/css" href="../common/css/docbook.css" /><link media="print" rel="stylesheet" type="text/css" href="../common/css/print.css" /><script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-41389295-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'path_to_url : 'path_to_url + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script></head><body><noscript><link rel="stylesheet" type="text/css" href="../common/css/print.css" /><div id="noscript">JavaScript is disabled on your browser. Please enable JavaScript to enjoy all the features of this site.</div></noscript><div id="header"><a href="path_to_url"><img id="logo" alt="Atmel Logo" src="../common/images/logo.png" /></a><h1>Atmel EDBG-based Tools Protocols<br />Serial trace commands</h1><div id="navheader"><!----><table class="navLinks"><tr><td><a title="Hide TOC tree" tabindex="5" class="pointLeft" onclick="myLayout.toggle('west')" href="#" id="showHideButton">Sidebar
</a></td><td><a tabindex="5" class="navLinkPrevious" accesskey="p" href="ch02s03s05.html">Prev</a>
|
<a tabindex="5" class="navLinkUp" accesskey="u" href="section_serial_trace.html">Up</a>
|
<a tabindex="5" class="navLinkNext" accesskey="n" href="ch02s03s07.html">Next</a></td></tr></table></div></div><div id="content"><!----><div class="section"><div xmlns="" class="titlepage"><div><div><h3 xmlns="path_to_url" class="title"><a id="N10511" />Get data</h3></div></div></div><p xmlns="path_to_url">Retrieves captured data along with status information. Note that up to 508 bytes can
be retrieved at a time.</p><div class="table"><a id="N10516" /><p class="title"><strong>Table 21. Get data</strong></p><div class="table-contents"><table summary="Get data" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Field</th><th>Size</th><th>Description</th></tr></thead><tbody><tr><td>SERIAL_TRACE</td><td>1 byte</td><td>0x87</td></tr><tr><td>GET_DATA</td><td>1 byte</td><td>0x08</td></tr></tbody></table></div></div><br class="table-break" /><p>Response:</p><div class="table"><a id="N1053E" /><p class="title"><strong>Table 22. Get data response</strong></p><div class="table-contents"><table summary="Get data response" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Field</th><th>Size</th><th>Description</th></tr></thead><tbody><tr><td>SERIAL_TRACE</td><td>1 byte</td><td>0x87</td></tr><tr><td>GET_DATA</td><td>1 byte</td><td>0x08</td></tr><tr><td>STATUS</td><td>2 bytes, MSB first</td><td><p>Status encoding</p>
<p>Bit 15: overrun error (buffer not read fast enough)</p>
<p>Bit 14: receive error (framing or baud rate error)</p>
<p>Bit 9: receive disabled (receiver has been disabled)</p>
<p>Bits 8..0: number of data bytes received</p></td></tr><tr><td>DATA</td><td>N bytes</td><td>Data streamed from the target device</td></tr></tbody></table></div></div><br class="table-break" /></div><script src="../common/main.js" type="text/javascript"><!----></script><script src="../common/splitterInit.js" type="text/javascript"><!----></script><div class="navfooter"><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="ch02s03s05.html">Prev</a> </td><td align="center" width="20%"><a accesskey="u" href="section_serial_trace.html">Up</a></td><td align="right" width="40%"> <a accesskey="n" href="ch02s03s07.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%"> </td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%"> </td></tr></table></div></div><div id="sidebar"><div style="padding-top:3px;" id="leftnavigation"><div id="tabs"><ul><li><a tabindex="1" style="outline:0;" href="#treeDiv"><span class="contentsTab">Contents</span></a></li><li><a onclick="doSearch()" tabindex="1" style="outline:0;" href="#searchDiv"><span class="searchTab">Search</span></a></li></ul><div id="treeDiv"><img style="display:block;" id="tocLoading" alt="loading table of contents..." src="../common/images/loading.gif" /><span class="dochome"><a href="../index.html" tabindex="1">Documentation Home</a></span><span class="root"><a href="index.html" tabindex="1">Atmel EDBG-based Tools Protocols</a></span><div style="display:none" id="ulTreeDiv"><ul class="filetree" id="tree"><li><span class="file"><a tabindex="1" href="pr01.html">Preface</a></span></li><li><span class="file"><a tabindex="1" href="protocoldocs.Introduction.html">Introduction</a></span><ul><li><span class="file"><a tabindex="1" href="ch01s01.html">EDBG interface overview</a></span></li><li><span class="file"><a tabindex="1" href="ch01s02.html">Atmel EDBG-based tool implementations</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="protocoldocs.cmsis_dap.html">CMSIS-DAP</a></span><ul><li><span class="file"><a tabindex="1" href="ch02s01.html">CMSIS-DAP protocol</a></span></li><li><span class="file"><a tabindex="1" href="ch02s02.html">CMSIS-DAP vendor commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch02s02s01.html">AVR-target specific vendor commands</a></span></li><li><span class="file"><a tabindex="1" href="ch02s02s02.html">ARM-target specific vendor commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch02s02s02s01.html">Erase pin</a></span></li><li><span class="file"><a tabindex="1" href="ch02s02s02s02.html">Serial trace</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch02s02s03.html">EDBG-specific vendor commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch02s02s03s01.html">Get configuration</a></span></li><li><span class="file"><a tabindex="1" href="ch02s02s03s02.html">Set configuration</a></span></li><li><span class="file"><a tabindex="1" href="ch02s02s03s03.html">EDBG GET request</a></span></li><li><span class="file"><a tabindex="1" href="ch02s02s03s04.html">EDBG SET request</a></span></li></ul></li></ul></li><li><span class="file"><a tabindex="1" href="section_serial_trace.html">Serial trace commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch02s03s01.html">Set transport mode</a></span></li><li><span class="file"><a tabindex="1" href="ch02s03s02.html">Set capture mode</a></span></li><li><span class="file"><a tabindex="1" href="ch02s03s03.html">Set baud rate</a></span></li><li><span class="file"><a tabindex="1" href="ch02s03s04.html">Start</a></span></li><li><span class="file"><a tabindex="1" href="ch02s03s05.html">Stop</a></span></li><li id="webhelp-currentid"><span class="file"><a tabindex="1" href="ch02s03s06.html">Get data</a></span></li><li><span class="file"><a tabindex="1" href="ch02s03s07.html">Get status</a></span></li><li><span class="file"><a tabindex="1" href="ch02s03s08.html">Get buffer size</a></span></li><li><span class="file"><a tabindex="1" href="ch02s03s09.html">Signon</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch02s04.html">Enveloped AVR commands, responses & events</a></span><ul><li><span class="file"><a tabindex="1" href="ch02s04s01.html">Wrapping AVR commands</a></span></li><li><span class="file"><a tabindex="1" href="ch02s04s02.html">Unwrapping AVR responses</a></span></li><li><span class="file"><a tabindex="1" href="ch02s04s03.html">Unwrapping AVR events</a></span></li></ul></li></ul></li><li><span class="file"><a tabindex="1" href="protocoldocs.edbg_ctrl_protocol.html">EDBG Control Protocol</a></span><ul><li><span class="file"><a tabindex="1" href="ch03s01.html">Protocol commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch03s01s01.html">QUERY</a></span><ul><li><span class="file"><a tabindex="1" href="section_edbg_query_contexts.html">EDBG QUERY contexts</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch03s01s02.html">SET</a></span></li><li><span class="file"><a tabindex="1" href="ch03s01s03.html">GET</a></span><ul><li><span class="file"><a tabindex="1" href="ch03s01s03s01.html">SET/GET parameters</a></span></li></ul></li></ul></li><li><span class="file"><a tabindex="1" href="ch03s02.html">Responses</a></span><ul><li><span class="file"><a tabindex="1" href="ch03s02s01.html">OK</a></span></li><li><span class="file"><a tabindex="1" href="ch03s02s02.html">LIST</a></span></li><li><span class="file"><a tabindex="1" href="ch03s02s03.html">DATA</a></span></li><li><span class="file"><a tabindex="1" href="ch03s02s04.html">FAILED</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="section_edbg_ctrl_setget_params.html">EDBGCTRL ID definitions</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="protocoldocs.avrprotocol.Overview.html">AVR communication protocol</a></span><ul><li><span class="file"><a tabindex="1" href="ch04s01.html">Overview</a></span></li><li><span class="file"><a tabindex="1" href="ch04s02.html">Framing</a></span></li><li><span class="file"><a tabindex="1" href="ch04s03.html">Protocol sub-set overview</a></span></li><li><span class="file"><a tabindex="1" href="ch04s04.html">Discovery Protocol Definition</a></span><ul><li><span class="file"><a tabindex="1" href="ch04s04s01.html">CMD: QUERY</a></span></li><li><span class="file"><a tabindex="1" href="section_jdx_m11_sl.html">Discovery QUERY contexts</a></span></li><li><span class="file"><a tabindex="1" href="ch04s04s03.html">RSP: LIST</a></span></li><li><span class="file"><a tabindex="1" href="ch04s04s04.html">RSP: FAILED</a></span></li><li><span class="file"><a tabindex="1" href="ch04s04s05.html">Discovery Protocol ID definitions</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch04s05.html">Housekeeping Protocol</a></span><ul><li><span class="file"><a tabindex="1" href="ch04s05s01.html">CMD: QUERY</a></span></li><li><span class="file"><a tabindex="1" href="section_i5v_3yz_rl.html">Housekeeping QUERY contexts</a></span></li><li><span class="file"><a tabindex="1" href="ch04s05s03.html">CMD: SET</a></span></li><li><span class="file"><a tabindex="1" href="ch04s05s04.html">CMD: GET</a></span></li><li><span class="file"><a tabindex="1" href="section_t1f_hb1_sl.html">Housekeeping SET/GET parameters</a></span></li><li><span class="file"><a tabindex="1" href="ch04s05s06.html">Housekeeping Commands</a></span><ul><li><span class="file"><a tabindex="1" href="section_housekeeping_start_session.html">Start session</a></span></li><li><span class="file"><a tabindex="1" href="ch04s05s06s02.html">End Session</a></span></li><li><span class="file"><a tabindex="1" href="ch04s05s06s03.html">Firmware Upgrade</a></span></li><li><span class="file"><a tabindex="1" href="ch04s05s06s04.html">JTAG scan-chain detection</a></span></li><li><span class="file"><a tabindex="1" href="ch04s05s06s05.html">Calibrate Oscillator</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch04s05s07.html">Housekeeping Responses</a></span><ul><li><span class="file"><a tabindex="1" href="ch04s05s07s01.html">OK</a></span></li><li><span class="file"><a tabindex="1" href="ch04s05s07s02.html">LIST</a></span></li><li><span class="file"><a tabindex="1" href="ch04s05s07s03.html">DATA</a></span></li><li><span class="file"><a tabindex="1" href="ch04s05s07s04.html">FAILED</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch04s05s08.html">Events</a></span><ul><li><span class="file"><a tabindex="1" href="ch04s05s08s01.html">Event: power</a></span></li><li><span class="file"><a tabindex="1" href="ch04s05s08s02.html">Event: sleep</a></span></li><li><span class="file"><a tabindex="1" href="ch04s05s08s03.html">Event: external reset</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch04s05s09.html">
Hints and tips
</a></span></li><li><span class="file"><a tabindex="1" href="ch04s05s10.html">Housekeeping ID definitions</a></span></li></ul></li></ul></li><li><span class="file"><a tabindex="1" href="protocoldocs.avr32protocol.html">AVR32 generic protocol</a></span><ul><li><span class="file"><a tabindex="1" href="ch05s01.html">Protocol commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch05s01s01.html">QUERY</a></span><ul><li><span class="file"><a tabindex="1" href="section_qhb_x1c_sl.html">AVR32 QUERY contexts</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch05s01s02.html">SET</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s03.html">GET</a></span><ul><li><span class="file"><a tabindex="1" href="section_avr32_setget_params.html">SET/GET parameters</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch05s01s04.html">Activate Physical</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s05.html">Deactivate Physical</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s06.html">Get ID</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s07.html">Erase</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s08.html">Halt</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s09.html">Reset</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s10.html">Step</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s11.html">Read</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s12.html">Write</a></span><ul><li><span class="file"><a tabindex="1" href="section_avr32_memtypes.html">Memory Types</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch05s01s13.html">TAP</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s14.html">Is protected</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s15.html">Erase Section</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch05s02.html">Responses</a></span><ul><li><span class="file"><a tabindex="1" href="ch05s02s01.html">OK</a></span></li><li><span class="file"><a tabindex="1" href="ch05s02s02.html">LIST</a></span></li><li><span class="file"><a tabindex="1" href="ch05s02s03.html">ID</a></span></li><li><span class="file"><a tabindex="1" href="ch05s02s04.html">PC</a></span></li><li><span class="file"><a tabindex="1" href="ch05s02s05.html">DATA</a></span></li><li><span class="file"><a tabindex="1" href="ch05s02s06.html">FAILED</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch05s03.html">Hints and tips</a></span><ul><li><span class="file"><a tabindex="1" href="ch05s03s01.html">Configuration</a></span></li><li><span class="file"><a tabindex="1" href="ch05s03s02.html">Activate and deactivate physical</a></span></li><li><span class="file"><a tabindex="1" href="ch05s03s03.html">Programming and debugging commands</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch05s04.html">AVR32GENERIC ID definitions</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="protocoldocs.avr8protocol.html">AVR8 generic protocol</a></span><ul><li><span class="file"><a tabindex="1" href="ch06s01.html">Protocol Commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch06s01s01.html">QUERY</a></span><ul><li><span class="file"><a tabindex="1" href="section_avr8_query_contexts.html">AVR8 QUERY contexts</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch06s01s02.html">SET</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s03.html">GET</a></span><ul><li><span class="file"><a tabindex="1" href="section_avr8_setget_params.html">SET/GET parameters</a></span><ul><li><span class="file"><a tabindex="1" href="section_avr8_setget_params.html#N11932">Device context: debugWIRE targets</a></span></li><li><span class="file"><a tabindex="1" href="section_avr8_setget_params.html#N119D3">Device context: megaAVR JTAG targets</a></span></li><li><span class="file"><a tabindex="1" href="section_avr8_setget_params.html#section_avr8_xmega_device_context">Device context: AVR XMEGA targets</a></span></li></ul></li></ul></li><li><span class="file"><a tabindex="1" href="ch06s01s04.html">Activate Physical</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s05.html">Deactivate Physical</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s06.html">Get ID</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s07.html">Attach</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s08.html">Detach</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s09.html">Reset</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s10.html">Stop</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s11.html">Run</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s12.html">Run To</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s13.html">Step</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s14.html">PC read</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s15.html">PC write</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s16.html">Prog Mode Enter</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s17.html">Prog Mode Leave</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s18.html">Disable debugWIRE</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s19.html">Erase</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s20.html">CRC</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s21.html">Memory Read</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s22.html">Memory Read masked</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s23.html">Memory Write</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s24.html">Page Erase</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s25.html">Hardware Breakpoint Set</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s26.html">Hardware Breakpoint Clear</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s27.html">Software Breakpoint Set</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s28.html">Software Breakpoint Clear</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s29.html">Software Breakpoint Clear All</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch06s02.html">Responses</a></span><ul><li><span class="file"><a tabindex="1" href="ch06s02s01.html">OK</a></span></li><li><span class="file"><a tabindex="1" href="ch06s02s02.html">LIST</a></span></li><li><span class="file"><a tabindex="1" href="ch06s02s03.html">PC</a></span></li><li><span class="file"><a tabindex="1" href="ch06s02s04.html">DATA</a></span></li><li><span class="file"><a tabindex="1" href="ch06s02s05.html">FAILED</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch06s03.html">Events</a></span><ul><li><span class="file"><a tabindex="1" href="ch06s03s01.html">Event: Break</a></span></li><li><span class="file"><a tabindex="1" href="ch06s03s02.html">Event: IDR message</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="section_avr8_memtypes.html">Memory Types</a></span><ul><li><span class="file"><a tabindex="1" href="ch06s04s01.html">debugWIRE memtypes</a></span></li><li><span class="file"><a tabindex="1" href="ch06s04s02.html">megaAVR (JTAG) OCD memtypes</a></span></li><li><span class="file"><a tabindex="1" href="ch06s04s03.html">AVR XMEGA memtypes</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch06s05.html">Hints and tips:</a></span><ul><li><span class="file"><a tabindex="1" href="ch06s05s01.html">Configuration</a></span></li><li><span class="file"><a tabindex="1" href="ch06s05s02.html">Activate and deactivate physical</a></span></li><li><span class="file"><a tabindex="1" href="ch06s05s03.html">Programming session control</a></span></li><li><span class="file"><a tabindex="1" href="ch06s05s04.html">Debug session control</a></span></li><li><span class="file"><a tabindex="1" href="ch06s05s05.html">Flow control</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch06s06.html">AVR8GENERIC ID definitions</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="protocoldocs.avrispprotocol.html">AVR ISP protocol</a></span><ul><li><span class="file"><a tabindex="1" href="ch07s01.html">SPI programming protocol commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch07s01s01.html">SPI Load Address</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s02.html">SPI Set Baud</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s03.html">SPI Get Baud</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s04.html">SPI Enter Programming Mode</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s05.html">SPI Leave Programming Mode</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s06.html">SPI Chip Erase</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s07.html">SPI Program Flash</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s08.html">SPI Read Flash</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s09.html">SPI Program EEPROM</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s10.html">SPI Read EEPROM</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s11.html">SPI Program Fuse</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s12.html">SPI Read Fuse</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s13.html">SPI Program Lock</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s14.html">SPI Read Lock</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s15.html">SPI Read Signature</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s16.html">SPI Read OSCCAL</a></span></li><li><span class="file"><a tabindex="1" href="ch07s01s17.html">SPI Multi</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch07s02.html">SPI programming protocol responses</a></span></li><li><span class="file"><a tabindex="1" href="ch07s03.html">ID definitions</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="protocoldocs.tpiprotocol.html">TPI Protocol</a></span><ul><li><span class="file"><a tabindex="1" href="ch08s01.html">TPI protocol commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch08s01s01.html">TPI Enter Programming Mode</a></span></li><li><span class="file"><a tabindex="1" href="ch08s01s02.html">TPI Leave Programming Mode</a></span></li><li><span class="file"><a tabindex="1" href="ch08s01s03.html">TPI Set Parameter</a></span></li><li><span class="file"><a tabindex="1" href="ch08s01s04.html">TPI Erase</a></span></li><li><span class="file"><a tabindex="1" href="ch08s01s05.html">TPI Write Memory</a></span></li><li><span class="file"><a tabindex="1" href="ch08s01s06.html">TPI Read Memory</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch08s02.html">TPI programming protocol responses</a></span></li><li><span class="file"><a tabindex="1" href="ch08s03.html">ID definitions</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="document.revisions.html">Document Revisions</a></span></li></ul></div></div><div id="searchDiv"><div id="search"><form class="searchForm" name="searchForm" onsubmit="Verifie(searchForm);return false"><div><input tabindex="1" class="searchText" placeholder="Search" type="search" name="textToSearch" id="textToSearch" /> <input tabindex="1" id="doSearch" value="Go" class="searchButton" type="button" onclick="Verifie(searchForm)" /></div></form></div><div id="searchResults"><center /></div><p class="searchHighlight"><a onclick="toggleHighlight()" href="#">Search Highlighter (On/Off)</a></p></div></div></div></div></body></html>
```
|
Derbyshire County Cricket Club in 1951 was the cricket season when the English club Derbyshire had been playing for eighty years. It was their forty-seventh season in the County Championship and they won five matches and lost seven to finish eleventh in the County Championship.
1951 season
Guy Willatt was in his first full year as captain. He had been appointed in the previous year but because of injury was substituted by Pat Vaulkhard for 1950. His appointment ended a period of uncertainty since the end of the Second World War, when apart from Edward Gothard, no one was available to captain for more than one year.
Derbyshire played 28 games in the County Championship, and one match against the touring South Africans. They won five matches altogether, but a disproportionate number of matches were drawn. Charlie Elliott was top scorer and C Gladwin took most wickets with 123.
The club retained a virtually unchanged squad with only one newcomer – Edwin Smith who played on for 20 years.
Matches
{| class="wikitable" width="100%"
! bgcolor="#efefef" colspan=6 | List of matches
|- bgcolor="#efefef"
!No.
!Date
!V
!Result
!Margin
!Notes
|-
|1
| 5 May 1951
| WorcestershireCounty Ground, New Road, Worcester
|bgcolor="#FFCC00"|Drawn
|
| Don Kenyon 100;
|-
|2
| 9 May 1951
| Leicestershire Grace Road, Leicester
|bgcolor="#FFCC00"|Drawn
|
| TA Hall 5–57
|-
|3
| 12 May 1951
| Warwickshire Edgbaston, Birmingham
|bgcolor="#FFCC00"|Drawn
|
|
|-
|4
|16 May 1951
| Sussex County Ground, Derby
|bgcolor="#FFCC00"|Drawn
|
| Langridge 200; AEG Rhodes 5–23
|-
|5
|19 May 1951
| Yorkshire Queen's Park, Chesterfield
|bgcolor="#FF0000"|Lost
|7 wickets
|
|-
|6
|26 May 1951
| Gloucestershire County Ground, Derby
|bgcolor="#FF0000"|Lost
|67 runs
| DC Morgan 6–93
|-
|7
|2 Jun 1951
| Glamorgan Cardiff Arms Park
|bgcolor="#FF0000"|Lost
|Innings and 120 runs
| Davies 146; Parkhouse 107; Jim McConnon 7–69 and 7–84
|-
|8
|6 Jun 1951
| Hampshire Queen's Park, Chesterfield
|bgcolor="#FFCC00"|Drawn
|
| Rogers 151; C Gladwin 6–108
|-
|9
|9 Jun 1951
| Northamptonshire County Ground, Northampton
|bgcolor="#FFCC00"|Drawn
|
| Oldfield 140
|-
|10
|13 Jun 1951
| Somerset Agricultural Showgrounds, Frome
|bgcolor="#00FF00"|Won
|125 runs
| J Redman 7–23
|-
|11
|16 Jun 1951
| Gloucestershire Wagon Works Ground, Gloucester
|bgcolor="#FFCC00"|Drawn
|
| Crapp 105; AC Revill 137
|-
|12
|20 Jun 1951
| Kent County Ground, Derby
|bgcolor="#FFCC00"|Drawn
|
| HL Jackson 5–90; Wright 5–90
|-
|13
|23 Jun 1951
| Lancashire Queen's Park, Chesterfield
|bgcolor="#FF0000"|Lost
|15 runs
| Washbrook 103;
|-
|14
|27 Jun 1951
| Essex Gidea Park Sports Ground, Romford
|bgcolor="#FFCC00"|Drawn
|
| CS Elliott 166; C Gladwin 5–65 and 5–44; Bailey 6–44;
|-
|15
|4 Jul 1951
|Middlesex Park Road Ground, Buxton
|bgcolor="#FFCC00"|Drawn
|
| A Hamer165;
|-
|16
|7 Jul 1951
| HampshireUnited Services Recreation Ground, Portsmouth
|bgcolor="#00FF00"|Won
|113 Runs
| AC Revill 104; C Gladwin 7–74; HL Jackson 5–34
|-
|17
|14 Jul 1951
| Lancashire Old Trafford, Manchester
|bgcolor="#FFCC00"|Drawn
|
| C Gladwin 5–42 and 5–76; Brian Statham 5–20
|-
|18
|18 Jul 1951
|Derbyshire v South Africans County Ground, Derby
|bgcolor="#FF0000"|Lost
|8 wickets
|
|-
|19
|21 Jul 1951
| Glamorgan Queen's Park, Chesterfield
|bgcolor="#FF0000"|Lost
|Innings and 94 runs
| Muncer 107, 5–34 and 5–23
|-
|20
|25 Jul 1951
| Kent Cheriton Road Sports Ground, Folkestone
|bgcolor="#00FF00"|Won
|177 runs
| DB Carr 103; Ridgway 6–44; C Gladwin 7–55; AEG Rhodes 6–57
|-
|21
|28 Jul 1951
| Nottinghamshire Rutland Recreation Ground, Ilkeston
|bgcolor="#00FF00"|Won
| Innings and 114 runs
| Willatt 111; AC Revill 123; C Gladwin 8–40
|-
|22
|1 Aug 1951
| Yorkshire St George's Road, Harrogate
|bgcolor="#FFCC00"|Drawn
|
| Wilson 120; Watson 108; Fred Trueman 6–59; Bob Appleyard 5–42
|-
|23
|4 Aug 1951
| Warwickshire County Ground, Derby
|bgcolor="#FFCC00"|Drawn
|
| Eric Hollies 7–67
|-
|24
|8 Aug 1951
| Worcestershire Queen's Park, Chesterfield
|bgcolor="#FF0000"|Lost
|139 runs
| C Gladwin 6–108; Howorth 5–33 and 5–32; E Smith 8–21; Perks 5–33
|-
|25
|11 Aug 1951
| Nottinghamshire Trent Bridge, Nottingham
|bgcolor="#FFCC00"|Drawn
|
| Clay 108; Cox 6–30
|-
|26
|15 Aug 1951
| Surrey County Ground, Derby
|bgcolor="#FFCC00"|Drawn
|
| CS Elliott 121; C Gladwin 5–80
|-
|27
|18 Aug 1951
| Sussex The Saffrons, Eastbourne
|bgcolor="#FFCC00"|Drawn
|
| Hubert Doggart 126; David Sheppard 183; James Langridge 5–84
|-
|28
|22 Aug 1951
| Leicestershire Ind Coope Ground, Burton-on-Trent
|bgcolor="#00FF00"|Won
|Innings and 23 runs
| A Eato 5–14; Sperry 5–60; HL Jackson 5–34; AEG Rhodes 5–49
|-
|29
|25 Aug 1951
| Essex Ind Coope Ground, Burton-on-Trent
|bgcolor="#FFCC00"|Drawn
|
| T Smith 5–22; C Gladwin 7–55
|-
|
Statistics
County Championship batting averages
Additionally John Eggar appeared in the match against the South Africans.
County Championship bowling averages
Wicket Keepers
GO Dawkes Catches 51, Stumping 9
See also
Derbyshire County Cricket Club seasons
1951 English cricket season
References
1951 in English cricket
Derbyshire County Cricket Club seasons
|
```javascript
/**
*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
'use strict';
class SCPane extends HTMLElement {
get header () {
if (!this._header) {
this._header = this.querySelector('button[role="tab"]');
}
return this._header;
}
get content () {
if (!this._content) {
this._content = this.querySelector('.content');
}
return this._content;
}
attachedCallback () {
this.header.addEventListener('click', _ => {
const customEvent = new CustomEvent('panel-change', {
bubbles: true
});
this.dispatchEvent(customEvent);
});
}
}
document.registerElement('sc-pane', SCPane);
```
|
```prolog
#!/usr/bin/env perl
#
#
#
# **********
#
#
# path_to_url
#
# Unless required by applicable law or agreed to in writing, software
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# **********
#
# **********
#
# This program is free software; you can redistribute it and/or modify
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# **********
#
# Purpose
#
# This script migrates application source code from the mbed TLS 1.3 API to the
# mbed TLS 2.0 API.
#
# The script processes the given source code and renames identifiers - functions
# types, enums etc, as
#
# Usage: rename.pl [-f datafile] [-s] [--] [filenames...]
#
use warnings;
use strict;
use utf8;
use Path::Class;
use open qw(:std utf8);
my $usage = "Usage: $0 [-f datafile] [-s] [--] [filenames...]\n";
(my $datafile = $0) =~ s/rename.pl$/data_files\/rename-1.3-2.0.txt/;
my $do_strings = 0;
while( @ARGV && $ARGV[0] =~ /^-/ ) {
my $opt = shift;
if( $opt eq '--' ) {
last;
} elsif( $opt eq '-f' ) {
$datafile = shift;
} elsif( $opt eq '-s' ) {
$do_strings = 1; shift;
} else {
die $usage;
}
}
my %subst;
open my $nfh, '<', $datafile or die "Could not read $datafile\n";
my $ident = qr/[_A-Za-z][_A-Za-z0-9]*/;
while( my $line = <$nfh> ) {
chomp $line;
my ( $old, $new ) = ( $line =~ /^($ident)\s+($ident)$/ );
if( ! $old || ! $new ) {
die "$0: $datafile:$.: bad input '$line'\n";
}
$subst{$old} = $new;
}
close $nfh or die;
my $string = qr/"(?:\\.|[^\\"])*"/;
my $space = qr/\s+/;
my $idnum = qr/[a-zA-Z0-9_]+/;
my $symbols = qr/[-!#\$%&'()*+,.\/:;<=>?@[\\\]^_`{|}~]+|"/;
my $lib_include_dir = dir($0)->parent->parent->subdir('include', 'mbedtls');
my $lib_source_dir = dir($0)->parent->parent->subdir('library');
# if we replace inside strings, we don't consider them a token
my $token = $do_strings ? qr/$space|$idnum|$symbols/
: qr/$string|$space|$idnum|$symbols/;
my %warnings;
# If no files were passed, exit...
if ( not defined($ARGV[0]) ){ die $usage; }
while( my $filename = shift )
{
print STDERR "$filename... ";
if( dir($filename)->parent eq $lib_include_dir ||
dir($filename)->parent eq $lib_source_dir )
{
die "Script cannot be executed on the mbed TLS library itself.";
}
if( -d $filename ) { print STDERR "skip (directory)\n"; next }
open my $rfh, '<', $filename or die;
my @lines = <$rfh>;
close $rfh or die;
my @out;
for my $line (@lines) {
if( $line =~ /#include/ ) {
$line =~ s/polarssl/mbedtls/;
$line =~ s/POLARSSL/MBEDTLS/;
push( @out, $line );
next;
}
my @words = ($line =~ /$token/g);
my $checkline = join '', @words;
if( $checkline eq $line ) {
my @new = map { exists $subst{$_} ? $subst{$_} : $_ } @words;
push( @out, join '', @new );
} else {
$warnings{$filename} = [] unless $warnings{$filename};
push @{ $warnings{$filename} }, $line;
push( @out, $line );
}
}
open my $wfh, '>', $filename or die;
print $wfh $_ for @out;
close $wfh or die;
print STDERR "done\n";
}
if( %warnings ) {
print "\nWarning: lines skipped due to unexpected characters:\n";
for my $filename (sort keys %warnings) {
print "in $filename:\n";
print for @{ $warnings{$filename} };
}
}
```
|
Samuel Israel Mulder (born Amsterdam 20 June 1792; died there 29 December 1862) was a Dutch-Jewish educationalist.
He was educated by his father and by David Friedrichsfeld, and then studied with his brother-in-law H. A. Wagenaar. His friends were Lemans, Somerhausen, and Ullman, all of them members of the circle Tongeleth, who applied themselves to the study of the Hebrew language. Mulder composed at this time a Hebrew romance, "Beruria," and a psalm (see Delitzsch, "Zur Geschichte der Jüdischen Poesie," Leipzig, 1836).
Mulder was also a member of Tot Nut en Beschaving, in the works of which many of his essays appeared. In 1812 Mulder became a Sabbath-school teacher; in 1817, a sworn translator at the tribunal; in 1835, inspector of religious schools; and in 1849, secretary of the Amsterdam congregation. From 1826 Mulder was regent (director) of the theological seminary Sa'adat Baḥurim, which was reformed by him and which became in 1836 an institution subsidized by the state. Mulder was nominated its regent-secretary for life.
Mulder's reputation is chiefly due to his translation of the Bible, especially of the Pentateuch, Psalms, and Book of Proverbs, that was first published in 1824 and has often been reprinted; it was the first translation into Dutch from the Hebrew. In collaboration with Lehmans he published (1825–31) the dictionary entitled "Nederlandsch-Hebreeuwsch Handwoordenboek" (2 vols.). In 1843 he began his "Bijbel voor de Israelietische Jeugd", which he finished in 1854 (17 vols.; translated into English by Perez of Philadelphia). In addition he published many books on the study of Hebrew, e.g.: "Chronologisch Handboekje," 1836; "Rudimenta" (a revision of Lehman), 1840; "Aardrijkskunde van het Heilig. Land," 1840; "Leesboekje," 1846; "Moreh Derek," 1861. Most of his essays and contributions to periodicals he collected in his "Verspreide Lettervruchten", 1844.
In 1843 the University of Giessen conferred upon Mulder the degree of Ph.D., and in 1860 he was decorated with the Order of the Netherlands Lion.
References
Recensent der Recensenten, 1826, No. 5
J. J. Belinfante, in Nederlandsche Spectator, 1863, Nos. 7, 8
E. B. Asscher, Levenschets van S. I. Mulder, Amsterdam, 1863
Koenen, Geschiedenis, p. 396
Jaarboeken, 1835, iv. 3-8; 1836, p. 353
Jaarboekje, 1863
External links
Ziva Shamir, Influence of Racine on 19th Century Hebrew Dramatic Poetry, Hebrew Literature Research Site (www.zivashamir.com)
1792 births
1862 deaths
19th-century Dutch people
19th-century Jewish biblical scholars
People from Amsterdam
University of Giessen alumni
Dutch Jews
Jewish translators of the Bible
19th-century translators
|
```java
package com.kalessil.phpStorm.phpInspectionsEA.inspectors.suspiciousAssignments.strategy;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.php.codeInsight.controlFlow.instructions.PhpAccessVariableInstruction;
import com.jetbrains.php.codeInsight.controlFlow.instructions.PhpEntryPointInstruction;
import com.jetbrains.php.lang.psi.elements.*;
import com.kalessil.phpStorm.phpInspectionsEA.utils.ExpressionSemanticUtil;
import com.kalessil.phpStorm.phpInspectionsEA.utils.MessagesPresentationUtil;
import com.kalessil.phpStorm.phpInspectionsEA.utils.OpenapiControlFlowUtil;
import com.kalessil.phpStorm.phpInspectionsEA.utils.OpenapiTypesUtil;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/*
* This file is part of the Php Inspections (EA Extended) package.
*
* (c) Vladimir Reznichenko <kalessil@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
final public class ParameterImmediateOverrideStrategy {
private static final String message = "This variable name has already been declared previously without being used.";
static public void apply(@NotNull Function function, @NotNull ProblemsHolder holder) {
/* general requirements for a function */
final Parameter[] params = function.getParameters();
final GroupStatement body = ExpressionSemanticUtil.getGroupStatement(function);
if (body == null || params.length == 0 || ExpressionSemanticUtil.countExpressionsInGroup(body) == 0) {
return;
}
final PhpEntryPointInstruction start = function.getControlFlow().getEntryPoint();
for (final Parameter param : params) {
/* overriding params by reference is totally fine */
if (param.isPassByRef()) {
continue;
}
final String parameterName = param.getName();
List<PhpAccessVariableInstruction> uses = OpenapiControlFlowUtil.getFollowingVariableAccessInstructions(start, parameterName);
/* at least 2 uses expected: override and any other operation */
if (uses.size() < 2) {
continue;
}
/* first use should be a write directly in function body */
final PhpPsiElement expression = uses.get(0).getAnchor();
final PsiElement parent = expression.getParent();
if (OpenapiTypesUtil.isAssignment(parent) && expression == ((AssignmentExpression) parent).getVariable()) {
/* the assignment must be directly in the body, no conditional/in-loop overrides are checked */
final PsiElement grandParent = parent.getParent();
if (grandParent != null && body != grandParent.getParent()) {
continue;
}
/* count name hits, to identify if original value was considered */
int nameHits = 0;
for (final Variable variable : PsiTreeUtil.findChildrenOfType(parent, Variable.class)) {
if (parameterName.equals(variable.getName()) && ++nameHits > 1) {
break;
}
}
if (nameHits == 1) {
holder.registerProblem(
expression,
MessagesPresentationUtil.prefixWithEa(message)
);
}
}
}
}
}
```
|
```objective-c
/*your_sha256_hash------------*/
/**
* This confidential and proprietary software may be used only as
* authorised by a licensing agreement from ARM Limited
* (C) COPYRIGHT 2011-2012 ARM Limited
* ALL RIGHTS RESERVED
*
* The entire notice above must be reproduced on all authorised
* copies and copies may only be made to the extent permitted
* by a licensing agreement from ARM Limited.
*
* @brief Soft IEEE-754 floating point library.
*/
/*your_sha256_hash------------*/
#ifndef SOFTFLOAT_H_INCLUDED
#define SOFTFLOAT_H_INCLUDED
#if defined __cplusplus
extern "C"
{
#endif
#if defined __cplusplus && !defined(_MSC_VER)
/* if compiling as C++, we need to define these macros in order to obtain all the macros in stdint.h . */
#define __STDC_LIMIT_MACROS
#define __STDC_CONSTANT_MACROS
#include <stdint.h>
#else
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned int uint32_t;
typedef signed int int32_t;
#endif
uint32_t clz32(uint32_t p);
/* targets that don't have UINT32_C probably don't have the rest of C99s stdint.h */
#ifndef UINT32_C
#define PASTE(a) a
#define UINT64_C(a) PASTE(a##ULL)
#define UINT32_C(a) PASTE(a##U)
#define INT64_C(a) PASTE(a##LL)
#define INT32_C(a) a
#define PRIX32 "X"
#define PRId32 "d"
#define PRIu32 "u"
#define PRIX64 "LX"
#define PRId64 "Ld"
#define PRIu64 "Lu"
#endif
/* sized soft-float types. These are mapped to the sized integer types of C99, instead of C's
floating-point types; this is because the library needs to maintain exact, bit-level control on all
operations on these data types. */
typedef uint16_t sf16;
typedef uint32_t sf32;
/* the five rounding modes that IEEE-754r defines */
typedef enum {
SF_UP = 0, /* round towards positive infinity */
SF_DOWN = 1, /* round towards negative infinity */
SF_TOZERO = 2, /* round towards zero */
SF_NEARESTEVEN = 3, /* round toward nearest value; if mid-between, round to even value */
SF_NEARESTAWAY = 4 /* round toward nearest value; if mid-between, round away from zero */
} roundmode;
/* narrowing float->float conversions */
sf16 sf32_to_sf16(sf32, roundmode);
/* widening float->float conversions */
sf32 sf16_to_sf32(sf16);
sf16 float_to_sf16(float, roundmode);
float sf16_to_float(sf16);
#if defined __cplusplus
}
#endif
#endif
```
|
```objective-c
/*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef __CIK_DPM_H__
#define __CIK_DPM_H__
extern const struct amdgpu_ip_block_version kv_smu_ip_block;
#endif
```
|
Events in the year 1888 in India.
Incumbents
Empress of India – Queen Victoria
Viceroy of India – The Earl of Dufferin
Viceroy of India – Henry Petty-Fitzmaurice, 5th Marquess of Lansdowne (from 10 December)
Events
National income - 4,773 million
Mohandas Karamchand Gandhi left to study in London.
Sree Narayana Guru, consecrated the first temple for the untouchables in Aruvippuram, Kerala, South India.
Law
Indian Reserve Forces Act
Births
17 January – Babu Gulabrai, writer and historian (d.1963).
21 April - Charu Chandra Biswas,.
5 September – Sarvepalli Radhakrishnan, philosopher and statesman, first Vice President of India and second President of India (d.1975).
7 November – C. V. Raman, physicist, awarded the 1930 Nobel Prize in Physics (d.1970).
11 November – J. B. Kripalani, Freedom Fighter, Congress President (d. 1982).
11 November – Abul Kalam Azad, Freedom Fighter (d.1958).
16 December – Harold Papworth, British educator, college principal and Indian civil service officer (d. 1953)
unknown date – Ahmad Saeed Dehlavi, freedom fighter and first general secretary of the Jamiat Ulama-e-Hind. (d. 1959).
References
India
Years of the 19th century in India
1888 in Asia
1880s in India
|
```html
<meta http-equiv="refresh" content="0; url=General-Query-Packets.html#qXfer%20executable%20filename%20read">
```
|
```pascal
{$INCLUDE doomrl.inc}
unit doomgfxio;
interface
uses vglquadrenderer, vgltypes, vluaconfig, vioevent, viotypes, vuielement, vimage,
vrltools, vutil,
doomio, doomspritemap, doomanimation, dfdata;
type
{ TDoomGFXIO }
TDoomGFXIO = class( TDoomIO )
constructor Create; reintroduce;
procedure Reconfigure( aConfig : TLuaConfig ); override;
procedure Configure( aConfig : TLuaConfig; aReload : Boolean = False ); override;
procedure Update( aMSec : DWord ); override;
function RunUILoop( aElement : TUIElement = nil ) : DWord; override;
function OnEvent( const event : TIOEvent ) : Boolean; override;
procedure UpdateMinimap;
destructor Destroy; override;
function ChooseTarget( aActionName : string; aRange: byte; aLimitRange : Boolean; aTargets: TAutoTarget; aShowLast: Boolean): TCoord2D; override;
procedure WaitForAnimation; override;
function AnimationsRunning : Boolean; override;
procedure Mark( aCoord : TCoord2D; aColor : Byte; aChar : Char; aDuration : DWord; aDelay : DWord = 0 ); override;
procedure Blink( aColor : Byte; aDuration : Word = 100; aDelay : DWord = 0); override;
procedure addMoveAnimation( aDuration : DWord; aDelay : DWord; aUID : TUID; aFrom, aTo : TCoord2D; aSprite : TSprite ); override;
procedure addScreenMoveAnimation( aDuration : DWord; aDelay : DWord; aTo : TCoord2D ); override;
procedure addCellAnimation( aDuration : DWord; aDelay : DWord; aCoord : TCoord2D; aSprite : TSprite; aValue : Integer ); override;
procedure addMissileAnimation( aDuration : DWord; aDelay : DWord; aSource, aTarget : TCoord2D; aColor : Byte; aPic : Char; aDrawDelay : Word; aSprite : TSprite; aRay : Boolean = False ); override;
procedure addMarkAnimation( aDuration : DWord; aDelay : DWord; aCoord : TCoord2D; aColor : Byte; aPic : Char ); override;
procedure addSoundAnimation( aDelay : DWord; aPosition : TCoord2D; aSoundID : DWord ); override;
procedure DeviceChanged;
function DeviceCoordToConsoleCoord( aCoord : TIOPoint ) : TIOPoint; override;
function ConsoleCoordToDeviceCoord( aCoord : TIOPoint ) : TIOPoint; override;
procedure RenderUIBackground( aUL, aBR : TIOPoint ); override;
protected
procedure ExplosionMark( aCoord : TCoord2D; aColor : Byte; aDuration : DWord; aDelay : DWord ); override;
procedure SetTarget( aTarget : TCoord2D; aColor : Byte; aRange : Byte ); override;
function FullScreenCallback( aEvent : TIOEvent ) : Boolean;
procedure ResetVideoMode;
procedure ReuploadTextures;
procedure RecalculateScaling( aInitialize : Boolean );
procedure CalculateConsoleParams;
procedure SetMinimapScale( aScale : Byte );
private
FQuadSheet : TGLQuadList;
FTextSheet : TGLQuadList;
FPostSheet : TGLQuadList;
FQuadRenderer: TGLQuadRenderer;
FProjection : TMatrix44;
FFontMult : Byte;
FTileMult : Byte;
FMiniScale : Byte;
FLinespace : Word;
FVPadding : DWord;
FCellX : Integer;
FCellY : Integer;
FFontSizeX : Byte;
FFontSizeY : Byte;
FFullscreen : Boolean;
FLastMouseTime : QWord;
FMouseLock : Boolean;
FMCursor : TDoomMouseCursor;
FMinimapImage : TImage;
FMinimapTexture : DWord;
FMinimapScale : Integer;
FMinimapGLPos : TGLVec2i;
FAnimations : TAnimationManager;
public
property QuadSheet : TGLQuadList read FQuadSheet;
property TextSheet : TGLQuadList read FTextSheet;
property PostSheet : TGLQuadList read FPostSheet;
property FontMult : Byte read FFontMult;
property TileMult : Byte read FTileMult;
property MCursor : TDoomMouseCursor read FMCursor;
end;
implementation
uses {$IFDEF WINDOWS}windows,{$ENDIF}
classes, sysutils, math,
vdebug, vlog, vmath, vdf, vgl3library, vtigstyle,
vglimage, vsdlio, vbitmapfont, vcolor, vglconsole, vioconsole,
dfplayer,
doombase, doomtextures, doomconfiguration;
const ConsoleSizeX = 80;
ConsoleSizeY = 25;
procedure TDoomGFXIO.RecalculateScaling( aInitialize : Boolean );
var iWidth : Integer;
iHeight : Integer;
iOldFontMult : Integer;
iOldTileMult : Integer;
iOldMiniScale : Integer;
begin
iWidth := FIODriver.GetSizeX;
iHeight := FIODriver.GetSizeY;
iOldFontMult := FFontMult;
iOldTileMult := FTileMult;
iOldMiniScale := FMiniScale;
FFontMult := Configuration.GetInteger( 'font_multiplier' );
FTileMult := Configuration.GetInteger( 'tile_multiplier' );
FMiniScale := Configuration.GetInteger( 'minimap_multiplier' );
if FFontMult = 0 then
if (iWidth >= 1600) and (iHeight >= 900)
then FFontMult := 2
else FFontMult := 1;
if FTileMult = 0 then
if (iWidth >= 1050) and (iHeight >= 1050)
then FTileMult := 2
else FTileMult := 1;
if FMiniScale = 0 then
begin
FMiniScale := iWidth div 220;
FMiniScale := Max( 3, FMiniScale );
FMiniScale := Min( 9, FMiniScale );
end;
if aInitialize then Exit;
if FMiniScale <> iOldMiniScale then
SetMinimapScale( FMiniScale );
if FTileMult <> iOldTileMult then
begin
SpriteMap.Recalculate;
if Player <> nil then
SpriteMap.NewShift := SpriteMap.ShiftValue( Player.Position );
end;
if FFontMult <> iOldFontMult then
begin
CalculateConsoleParams;
TGLConsoleRenderer( FConsole ).SetPositionScale( (FIODriver.GetSizeX - ConsoleSizeX*FFontSizeX*FFontMult) div 2, 0, FLineSpace, FFontMult );
end;
end;
constructor TDoomGFXIO.Create;
var iCoreData : TVDataFile;
iImage : TImage;
iFontTexture: TTextureID;
iFont : TBitmapFont;
iStream : TStream;
iSDLFlags : TSDLIOFlags;
iMode : TIODisplayMode;
iFontName : Ansistring;
iWidth : Integer;
iHeight : Integer;
begin
FLastMouseTime := 0;
FMouseLock := True;
FLoading := nil;
IO := Self;
FVPadding := 0;
FFontMult := 1;
FTileMult := 1;
FMCursor := nil;
Textures := nil;
{$IFDEF WINDOWS}
if not GodMode then
begin
FreeConsole;
vdebug.DebugWriteln := nil;
end
else
begin
Logger.AddSink( TConsoleLogSink.Create( LOGDEBUG, True ) );
end;
{$ENDIF}
FFullscreen := Configuration.GetBoolean( 'fullscreen' );
iWidth := Configuration.GetInteger( 'screen_width' );
iHeight := Configuration.GetInteger( 'screen_height' );
iSDLFlags := [ SDLIO_OpenGL ];
if FFullscreen then Include( iSDLFlags, SDLIO_Fullscreen );
FIODriver := TSDLIODriver.Create( iWidth, iHeight, 32, iSDLFlags );
begin
Log('Display modes (%d)', [FIODriver.DisplayModes.Size] );
Log('-------');
for iMode in FIODriver.DisplayModes do
Log('%d x %d @%d', [ iMode.Width, iMode.Height, iMode.Refresh ] );
Log('-------');
end;
Textures := TDoomTextures.Create;
iFontName := 'font10x18.png';
FFontSizeX := 10;
FFontSizeY := 18;
if GodMode then
iImage := LoadImage(iFontName)
else
begin
iCoreData := TVDataFile.Create(DataPath+'drl.wad');
iCoreData.DKKey := LoveLace;
iStream := iCoreData.GetFile( iFontName, 'fonts' );
iImage := LoadImage( iStream, iStream.Size );
FreeAndNil( iStream );
FreeAndNil( iCoreData );
end;
iFontTexture := Textures.AddImage( iFontName, iImage, Option_Blending );
Textures[ iFontTexture ].Image.SubstituteColor( ColorBlack, ColorZero );
Textures[ iFontTexture ].Upload;
iFont := TBitmapFont.CreateFromGrid( iFontTexture, 32, 256-32, 32 );
RecalculateScaling( True );
CalculateConsoleParams;
FConsole := TGLConsoleRenderer.Create( iFont, ConsoleSizeX, ConsoleSizeY, FLineSpace, [VIO_CON_CURSOR, VIO_CON_BGCOLOR, VIO_CON_EXTCOLOR ] );
TGLConsoleRenderer( FConsole ).SetPositionScale(
(FIODriver.GetSizeX - ConsoleSizeX*FFontSizeX*FFontMult) div 2,
0,
FLineSpace,
FFontMult
);
SpriteMap := TDoomSpriteMap.Create;
FMCursor := TDoomMouseCursor.Create;
TSDLIODriver( FIODriver ).ShowMouse( False );
//RRGGBBAA
VTIGDefaultStyle.Color[ VTIG_BACKGROUND_COLOR ] := $10000000;
VTIGDefaultStyle.Color[ VTIG_SELECTED_BACKGROUND_COLOR ] := $442222FF;
VTIGDefaultStyle.Color[ VTIG_INPUT_TEXT_COLOR ] := LightGray;
VTIGDefaultStyle.Color[ VTIG_INPUT_BACKGROUND_COLOR ] := $442222FF;
inherited Create;
FQuadSheet := TGLQuadList.Create;
FTextSheet := TGLQuadList.Create;
FPostSheet := TGLQuadList.Create;
FQuadRenderer := TGLQuadRenderer.Create;
FMinimapScale := 0;
FMinimapTexture := 0;
FMinimapGLPos := TGLVec2i.Create( 0, 0 );
FMinimapImage := TImage.Create( 128, 32 );
FMinimapImage.Fill( NewColor( 0,0,0,0 ) );
SetMinimapScale( FMiniScale );
FAnimations := TAnimationManager.Create;
end;
procedure TDoomGFXIO.Reconfigure(aConfig: TLuaConfig);
var iWidth : Integer;
iHeight : Integer;
begin
iWidth := Configuration.GetInteger('screen_width');
iHeight := Configuration.GetInteger('screen_height');
if ( ( iWidth > 0 ) and ( iWidth <> FIODriver.GetSizeX ) ) or
( ( iHeight > 0 ) and ( iHeight <> FIODriver.GetSizeY ) ) or
( Configuration.GetBoolean('fullscreen') <> FFullscreen ) then
begin
FFullscreen := Configuration.GetBoolean('fullscreen');
ResetVideoMode;
end
else
RecalculateScaling( False );
inherited Reconfigure(aConfig);
end;
destructor TDoomGFXIO.Destroy;
begin
FreeAndNil( FMCursor );
FreeAndNil( FQuadSheet );
FreeAndNil( FTextSheet );
FreeAndNil( FPostSheet );
FreeAndNil( FQuadRenderer );
FreeAndNil( FMinimapImage );
FreeAndNil( FAnimations );
FreeAndNil( SpriteMap );
FreeAndNil( Textures );
inherited Destroy;
end;
function TDoomGFXIO.ChooseTarget( aActionName : string; aRange: byte; aLimitRange : Boolean; aTargets: TAutoTarget; aShowLast: Boolean ): TCoord2D;
begin
ChooseTarget := inherited ChooseTarget( aActionName, aRange, aLimitRange, aTargets, aShowLast );
SpriteMap.ClearTarget;
end;
procedure TDoomGFXIO.WaitForAnimation;
begin
inherited WaitForAnimation;
FAnimations.Clear;
end;
function TDoomGFXIO.AnimationsRunning : Boolean;
begin
if Doom.State <> DSPlaying then Exit(False);
Exit( not FAnimations.Finished );
end;
procedure TDoomGFXIO.Mark( aCoord: TCoord2D; aColor: Byte; aChar: Char; aDuration: DWord; aDelay: DWord );
begin
FAnimations.AddAnimation( TDoomMark.Create( aDuration, aDelay, aCoord ) );
end;
procedure TDoomGFXIO.Blink( aColor : Byte; aDuration : Word = 100; aDelay : DWord = 0);
begin
if not Setting_NoFlash then
FAnimations.AddAnimation( TDoomBlink.Create(aDuration,aDelay,aColor) );
end;
procedure TDoomGFXIO.addMoveAnimation ( aDuration : DWord; aDelay : DWord; aUID : TUID; aFrom, aTo : TCoord2D; aSprite : TSprite );
begin
if Doom.State <> DSPlaying then Exit;
FAnimations.AddAnimation(TDoomMove.Create(aDuration, aDelay, aUID, aFrom, aTo, aSprite));
end;
procedure TDoomGFXIO.addScreenMoveAnimation(aDuration: DWord; aDelay: DWord; aTo: TCoord2D);
begin
if Doom.State <> DSPlaying then Exit;
FAnimations.addAnimation( TDoomScreenMove.Create( aDuration, aDelay, aTo ) );
end;
procedure TDoomGFXIO.addCellAnimation( aDuration : DWord; aDelay : DWord; aCoord : TCoord2D; aSprite : TSprite; aValue : Integer );
begin
if Doom.State <> DSPlaying then Exit;
FAnimations.addAnimation( TDoomAnimateCell.Create( aDuration, aDelay, aCoord, aSprite, aValue ) );
end;
procedure TDoomGFXIO.addMissileAnimation(aDuration: DWord; aDelay: DWord; aSource,
aTarget: TCoord2D; aColor: Byte; aPic: Char; aDrawDelay: Word;
aSprite: TSprite; aRay: Boolean);
begin
if Doom.State <> DSPlaying then Exit;
FAnimations.addAnimation(
TDoomMissile.Create( aDuration, aDelay, aSource,
aTarget, aDrawDelay, aSprite, aRay ) );
end;
procedure TDoomGFXIO.addMarkAnimation(aDuration: DWord; aDelay: DWord;
aCoord: TCoord2D; aColor: Byte; aPic: Char);
begin
if Doom.State <> DSPlaying then Exit;
FAnimations.addAnimation( TDoomMark.Create(aDuration, aDelay, aCoord ) )
end;
procedure TDoomGFXIO.addSoundAnimation(aDelay: DWord; aPosition: TCoord2D; aSoundID: DWord);
begin
if Doom.State <> DSPlaying then Exit;
FAnimations.addAnimation( TDoomSoundEvent.Create( aDelay, aPosition, aSoundID ) )
end;
procedure TDoomGFXIO.ExplosionMark( aCoord : TCoord2D; aColor : Byte; aDuration : DWord; aDelay : DWord );
begin
FAnimations.AddAnimation( TDoomExplodeMark.Create(aDuration,aDelay,aCoord,aColor) )
end;
procedure TDoomGFXIO.SetTarget( aTarget : TCoord2D; aColor : Byte; aRange : Byte );
begin
SpriteMap.SetTarget( aTarget, NewColor( aColor ), True )
end;
procedure TDoomGFXIO.Configure( aConfig : TLuaConfig; aReload : Boolean = False );
begin
inherited Configure( aConfig, aReload );
FIODriver.RegisterInterrupt( IOKeyCode( VKEY_ENTER, [ VKMOD_ALT ] ), @FullScreenCallback );
FIODriver.RegisterInterrupt( IOKeyCode( VKEY_F12, [ VKMOD_CTRL ] ), @FullScreenCallback );
DeviceChanged;
end;
procedure TDoomGFXIO.Update( aMSec : DWord );
const UnitTex : TGLVec2f = ( Data : ( 1, 1 ) );
ZeroTex : TGLVec2f = ( Data : ( 0, 0 ) );
var iMousePos : TIOPoint;
iPoint : TIOPoint;
iValueX : Single;
iValueY : Single;
iActiveX : Integer;
iActiveY : Integer;
iMaxX : Integer;
iMaxY : Integer;
iShift : TCoord2D;
iSizeY : DWord;
iSizeX : DWord;
iMinus : Integer;
iAbsolute : TIORect;
iP1, iP2 : TIOPoint;
begin
if not Assigned( FQuadRenderer ) then Exit;
if FTime - FLastMouseTime > 3000 then
begin
FMCursor.Active := False;
SetTempHint('');
end;
if (FMCursor.Active) and FIODriver.GetMousePos( iPoint ) and (not FMouseLock) and (not isModal) then
begin
iMaxX := FIODriver.GetSizeX;
iMaxY := FIODriver.GetSizeY;
iValueX := 0;
iValueY := 0;
iActiveX := iMaxX div 8;
iActiveY := iMaxY div 8;
if iPoint.X < iActiveX then iValueX := ((iActiveX - iPoint.X) / iActiveX);
if iPoint.X > iMaxX-iActiveX then iValueX := ((iActiveX -(iMaxX-iPoint.X)) /iActiveX);
if iPoint.X < iActiveX then iValueX := -iValueX;
if iMaxY < MAXY*FTileMult*32 then
begin
if iPoint.Y < iActiveY then iValueY := ((iActiveY - iPoint.Y) / iActiveY) / 2;
if iPoint.Y > iMaxY-iActiveY then iValueY := ((iActiveY -(iMaxY-iPoint.Y)) /iActiveY) / 2;
if iPoint.Y < iActiveY then iValueY := -iValueY;
end;
iShift := SpriteMap.Shift;
if (iValueX <> 0) or (iValueY <> 0) then
begin
iShift := NewCoord2D(
Clamp( SpriteMap.Shift.X + Ceil( iValueX * aMSec ), SpriteMap.MinShift.X, SpriteMap.MaxShift.X ),
Clamp( SpriteMap.Shift.Y + Ceil( iValueY * aMSec ), SpriteMap.MinShift.Y, SpriteMap.MaxShift.Y )
);
SpriteMap.NewShift := iShift;
FMouseLock :=
((iShift.X = SpriteMap.MinShift.X) or (iShift.X = SpriteMap.MaxShift.X))
and ((iShift.Y = SpriteMap.MinShift.Y) or (iShift.Y = SpriteMap.MaxShift.Y));
end;
end;
FAnimations.Update( aMSec );
iSizeY := FIODriver.GetSizeY-2*FVPadding;
iSizeX := FIODriver.GetSizeX;
glViewport( 0, FVPadding, iSizeX, iSizeY );
glEnable( GL_TEXTURE_2D );
glDisable( GL_DEPTH_TEST );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
FProjection := GLCreateOrtho( 0, iSizeX, iSizeY, 0, -16384, 16384 );
if (Doom <> nil) and (Doom.State = DSPlaying) then
begin
if FConsoleWindow = nil then
FConsole.HideCursor;
//if not UI.AnimationsRunning then SpriteMap.NewShift := SpriteMap.ShiftValue( Player.Position );
SpriteMap.Update( aMSec, FProjection );
FAnimations.Draw;
glEnable( GL_DEPTH_TEST );
SpriteMap.Draw;
glDisable( GL_DEPTH_TEST );
end;
if FHudEnabled then
begin
FQuadSheet.PushTexturedQuad(
FMinimapGLPos,
FMinimapGLPos + TGLVec2i.Create( FMinimapScale*128, FMinimapScale*32 ),
ZeroTex, UnitTex, FMinimapTexture );
iAbsolute := vutil.Rectangle( 1,1,ConsoleSizeX,ConsoleSizeY );
iP1 := ConsoleCoordToDeviceCoord( iAbsolute.Pos );
iP2 := ConsoleCoordToDeviceCoord( vutil.Point( iAbsolute.x2+1, iAbsolute.y+2 ) );
QuadSheet.PushColoredQuad( TGLVec2i.Create( iP1.x, iP1.y ), TGLVec2i.Create( iP2.x, iP2.y ), TGLVec4f.Create( 0,0,0,0.8 ) );
iMinus := 1;
if StatusEffect = StatusInvert then
iMinus := 2;
iP1 := ConsoleCoordToDeviceCoord( vutil.Point( iAbsolute.x, iAbsolute.y2-iMinus ) );
iP2 := ConsoleCoordToDeviceCoord( vutil.Point( iAbsolute.x2+1, iAbsolute.y2+2 ) );
QuadSheet.PushColoredQuad( TGLVec2i.Create( iP1.x, iP1.y ), TGLVec2i.Create( iP2.x, iP2.y ), TGLVec4f.Create( 0,0,0,0.8 ) );
end;
FQuadRenderer.Update( FProjection );
FQuadRenderer.Render( FQuadSheet );
inherited Update( aMSec );
if FTextSheet <> nil then FQuadRenderer.Render( FTextSheet );
if (FPostSheet <> nil) and (FMCursor <> nil) and (FMCursor.Active) and FIODriver.GetMousePos(iMousePos) then
begin
FMCursor.Draw( iMousePos.X, iMousePos.Y, FLastUpdate, FPostSheet );
end;
if FPostSheet <> nil then FQuadRenderer.Render( FPostSheet );
end;
procedure TDoomGFXIO.ResetVideoMode;
var iSDLFlags : TSDLIOFlags;
iWidth : Integer;
iHeight : Integer;
begin
iSDLFlags := [ SDLIO_OpenGL ];
iWidth := Configuration.GetInteger('screen_width');
iHeight := Configuration.GetInteger('screen_height');
if FFullscreen then Include( iSDLFlags, SDLIO_Fullscreen );
TSDLIODriver(FIODriver).ResetVideoMode( iWidth, iHeight, 32, iSDLFlags );
RecalculateScaling( True );
ReuploadTextures;
CalculateConsoleParams;
TGLConsoleRenderer( FConsole ).SetPositionScale( (FIODriver.GetSizeX - ConsoleSizeX*FFontSizeX*FFontMult) div 2, 0, FLineSpace, FFontMult );
TGLConsoleRenderer( FConsole ).HideCursor;
SetMinimapScale(FMiniScale);
DeviceChanged;
SpriteMap.Recalculate;
if Player <> nil then
SpriteMap.NewShift := SpriteMap.ShiftValue( Player.Position );
end;
function TDoomGFXIO.FullScreenCallback ( aEvent : TIOEvent ) : Boolean;
begin
FFullscreen := not TSDLIODriver(FIODriver).FullScreen;
ResetVideoMode;
Exit( True );
end;
procedure TDoomGFXIO.ReuploadTextures;
begin
Textures.Upload;
SpriteMap.ReassignTextures;
end;
procedure TDoomGFXIO.CalculateConsoleParams;
begin
FLineSpace := Max((FIODriver.GetSizeY - ConsoleSizeY*FFontSizeY*FFontMult - 2*FVPadding) div ConsoleSizeY div FFontMult,0);
end;
function TDoomGFXIO.OnEvent( const event : TIOEvent ) : Boolean;
begin
if event.EType in [ VEVENT_MOUSEMOVE, VEVENT_MOUSEDOWN ] then
begin
if FMCursor <> nil then FMCursor.Active := True;
FLastMouseTime := FTime;
FMouseLock := False;
end;
Exit( inherited OnEvent( event ) )
end;
function TDoomGFXIO.RunUILoop( aElement : TUIElement = nil ) : DWord;
begin
if FMCursor <> nil then
begin
if FMCursor.Size = 0 then
FMCursor.SetTextureID( Textures.TextureID['cursor'], 32 );
FMCursor.Active := True;
end;
Exit( inherited RunUILoop( aElement ) );
end;
procedure TDoomGFXIO.UpdateMinimap;
var x, y : DWord;
begin
if Doom.State = DSPlaying then
begin
for x := 0 to MAXX+1 do
for y := 0 to MAXY+1 do
FMinimapImage.ColorXY[x,y] := Doom.Level.GetMiniMapColor( NewCoord2D( x, y ) );
if FMinimapTexture = 0
then FMinimapTexture := UploadImage( FMinimapImage, False )
else ReUploadImage( FMinimapTexture, FMinimapImage, False );
end;
end;
procedure TDoomGFXIO.SetMinimapScale ( aScale : Byte ) ;
begin
FMinimapScale := aScale;
FMinimapGLPos.Init( FIODriver.GetSizeX - FMinimapScale*(MAXX+2) - 10, FIODriver.GetSizeY - FMinimapScale*(MAXY+2) - ( 10 + FFontMult*20*3 ) );
UpdateMinimap;
end;
procedure TDoomGFXIO.DeviceChanged;
begin
FUIRoot.DeviceChanged;
FCellX := (FConsole.GetDeviceArea.Dim.X) div (FConsole.SizeX);
FCellY := (FConsole.GetDeviceArea.Dim.Y) div (FConsole.SizeY);
end;
function TDoomGFXIO.DeviceCoordToConsoleCoord( aCoord : TIOPoint ) : TIOPoint;
begin
aCoord := aCoord - FConsole.GetDeviceArea.Pos;
aCoord.x := ( aCoord.x div FCellX );
aCoord.y := ( aCoord.y div FCellY );
Exit( PointUnit + aCoord );
end;
function TDoomGFXIO.ConsoleCoordToDeviceCoord( aCoord : TIOPoint ) : TIOPoint;
begin
aCoord := aCoord - PointUnit;
aCoord.x := ( aCoord.x * FCellX );
aCoord.y := ( aCoord.y * FCellY );
Exit( FConsole.GetDeviceArea.Pos + aCoord );
end;
procedure TDoomGFXIO.RenderUIBackground( aUL, aBR : TIOPoint );
var iP1,iP2 : TIOPoint;
begin
iP1 := ConsoleCoordToDeviceCoord( aUL + PointUnit );
iP2 := ConsoleCoordToDeviceCoord( aBR + PointUnit );
QuadSheet.PushColoredQuad( TGLVec2i.Create( iP1.x, iP1.y ), TGLVec2i.Create( iP2.x, iP2.y ), TGLVec4f.Create( 0,0,0,0.85 ) );
end;
end.
```
|
```objective-c
/*
* This file is part of libsidplayfp, a SID player engine.
*
*
* This program is free software; you can redistribute it and/or modify
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef OPAMP_H
#define OPAMP_H
#include <memory>
#include <vector>
#include "Spline.h"
#include "sidcxx11.h"
namespace reSIDfp
{
/**
* Find output voltage in inverting gain and inverting summer SID op-amp
* circuits, using a combination of Newton-Raphson and bisection.
*
* +---R2--+
* | |
* vi ---R1--o--[A>--o-- vo
* vx
*
* From Kirchoff's current law it follows that
*
* IR1f + IR2r = 0
*
* Substituting the triode mode transistor model K*W/L*(Vgst^2 - Vgdt^2)
* for the currents, we get:
*
* n*((Vddt - vx)^2 - (Vddt - vi)^2) + (Vddt - vx)^2 - (Vddt - vo)^2 = 0
*
* where n is the ratio between R1 and R2.
*
* Our root function f can thus be written as:
*
* f = (n + 1)*(Vddt - vx)^2 - n*(Vddt - vi)^2 - (Vddt - vo)^2 = 0
*
* Using substitution constants
*
* a = n + 1
* b = Vddt
* c = n*(Vddt - vi)^2
*
* the equations for the root function and its derivative can be written as:
*
* f = a*(b - vx)^2 - c - (b - vo)^2
* df = 2*((b - vo)*dvo - a*(b - vx))
*/
class OpAmp
{
private:
/// Current root position (cached as guess to speed up next iteration)
mutable double x;
const double Vddt;
const double vmin;
const double vmax;
std::unique_ptr<Spline> const opamp;
public:
/**
* Opamp input -> output voltage conversion
*
* @param opamp opamp mapping table as pairs of points (in -> out)
* @param Vddt transistor dt parameter (in volts)
* @param vmin
* @param vmax
*/
OpAmp(const std::vector<Spline::Point> &opamp, double Vddt,
double vmin, double vmax
) :
x(0.),
Vddt(Vddt),
vmin(vmin),
vmax(vmax),
opamp(new Spline(opamp)) {}
/**
* Reset root position
*/
void reset() const
{
x = vmin;
}
/**
* Solve the opamp equation for input vi in loading context n
*
* @param n the ratio of input/output loading
* @param vi input voltage
* @return vo output voltage
*/
double solve(double n, double vi) const;
};
} // namespace reSIDfp
#endif
```
|
```javascript
import { BPagination } from './pagination'
import { pluginFactory } from '../../utils/plugins'
const PaginationPlugin = /*#__PURE__*/ pluginFactory({
components: { BPagination }
})
export { PaginationPlugin, BPagination }
```
|
```c++
/*
* (See accompanying file LICENSE_1_0.txt or copy at
* path_to_url
*
*/
/*!
* \file atomic/detail/core_arch_ops_gcc_alpha.hpp
*
* This header contains implementation of the \c core_arch_operations template.
*/
#ifndef BOOST_ATOMIC_DETAIL_CORE_ARCH_OPS_GCC_ALPHA_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_CORE_ARCH_OPS_GCC_ALPHA_HPP_INCLUDED_
#include <cstddef>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/storage_traits.hpp>
#include <boost/atomic/detail/core_arch_operations_fwd.hpp>
#include <boost/atomic/detail/header.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
namespace atomics {
namespace detail {
/*
Refer to path_to_url
(HP OpenVMS systems documentation) and the Alpha Architecture Reference Manual.
*/
/*
NB: The most natural thing would be to write the increment/decrement
operators along the following lines:
__asm__ __volatile__
(
"1: ldl_l %0,%1 \n"
"addl %0,1,%0 \n"
"stl_c %0,%1 \n"
"beq %0,1b\n"
: "=&b" (tmp)
: "m" (value)
: "cc"
);
However according to the comments on the HP website and matching
comments in the Linux kernel sources this defies branch prediction,
as the cpu assumes that backward branches are always taken; so
instead copy the trick from the Linux kernel, introduce a forward
branch and back again.
I have, however, had a hard time measuring the difference between
the two versions in microbenchmarks -- I am leaving it in nevertheless
as it apparently does not hurt either.
*/
struct core_arch_operations_gcc_alpha_base
{
static BOOST_CONSTEXPR_OR_CONST bool full_cas_based = false;
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
static BOOST_FORCEINLINE void fence_before(memory_order order) BOOST_NOEXCEPT
{
if ((static_cast< unsigned int >(order) & static_cast< unsigned int >(memory_order_release)) != 0u)
__asm__ __volatile__ ("mb" ::: "memory");
}
static BOOST_FORCEINLINE void fence_after(memory_order order) BOOST_NOEXCEPT
{
if ((static_cast< unsigned int >(order) & (static_cast< unsigned int >(memory_order_consume) | static_cast< unsigned int >(memory_order_acquire))) != 0u)
__asm__ __volatile__ ("mb" ::: "memory");
}
static BOOST_FORCEINLINE void fence_after_store(memory_order order) BOOST_NOEXCEPT
{
if (order == memory_order_seq_cst)
__asm__ __volatile__ ("mb" ::: "memory");
}
};
template< bool Signed, bool Interprocess >
struct core_arch_operations< 4u, Signed, Interprocess > :
public core_arch_operations_gcc_alpha_base
{
typedef typename storage_traits< 4u >::type storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 4u;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_alignment = 4u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
static BOOST_CONSTEXPR_OR_CONST bool is_interprocess = Interprocess;
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
fence_before(order);
storage = v;
fence_after_store(order);
}
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
{
storage_type v = storage;
fence_after(order);
return v;
}
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, tmp;
fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"mov %3, %1\n\t"
"ldl_l %0, %2\n\t"
"stl_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (tmp) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
fence_after(order);
return original;
}
static BOOST_FORCEINLINE bool compare_exchange_weak(
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
{
fence_before(success_order);
int success;
storage_type current;
__asm__ __volatile__
(
"1:\n\t"
"ldl_l %2, %4\n\t" // current = *(&storage)
"cmpeq %2, %0, %3\n\t" // success = current == expected
"mov %2, %0\n\t" // expected = current
"beq %3, 2f\n\t" // if (success == 0) goto end
"stl_c %1, %4\n\t" // storage = desired; desired = store succeeded
"mov %1, %3\n\t" // success = desired
"2:\n\t"
: "+r" (expected), // %0
"+r" (desired), // %1
"=&r" (current), // %2
"=&r" (success) // %3
: "m" (storage) // %4
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
if (success)
fence_after(success_order);
else
fence_after(failure_order);
return !!success;
}
static BOOST_FORCEINLINE bool compare_exchange_strong(
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
{
int success;
storage_type current, tmp;
fence_before(success_order);
__asm__ __volatile__
(
"1:\n\t"
"mov %5, %1\n\t" // tmp = desired
"ldl_l %2, %4\n\t" // current = *(&storage)
"cmpeq %2, %0, %3\n\t" // success = current == expected
"mov %2, %0\n\t" // expected = current
"beq %3, 2f\n\t" // if (success == 0) goto end
"stl_c %1, %4\n\t" // storage = tmp; tmp = store succeeded
"beq %1, 3f\n\t" // if (tmp == 0) goto retry
"mov %1, %3\n\t" // success = tmp
"2:\n\t"
".subsection 2\n\t"
"3: br 1b\n\t"
".previous\n\t"
: "+r" (expected), // %0
"=&r" (tmp), // %1
"=&r" (current), // %2
"=&r" (success) // %3
: "m" (storage), // %4
"r" (desired) // %5
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
if (success)
fence_after(success_order);
else
fence_after(failure_order);
return !!success;
}
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldl_l %0, %2\n\t"
"addl %0, %3, %1\n\t"
"stl_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
fence_after(order);
return original;
}
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldl_l %0, %2\n\t"
"subl %0, %3, %1\n\t"
"stl_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
fence_after(order);
return original;
}
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldl_l %0, %2\n\t"
"and %0, %3, %1\n\t"
"stl_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
fence_after(order);
return original;
}
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldl_l %0, %2\n\t"
"bis %0, %3, %1\n\t"
"stl_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
fence_after(order);
return original;
}
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldl_l %0, %2\n\t"
"xor %0, %3, %1\n\t"
"stl_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
fence_after(order);
return original;
}
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
{
return !!exchange(storage, (storage_type)1, order);
}
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
{
store(storage, 0, order);
}
};
template< bool Interprocess >
struct core_arch_operations< 1u, false, Interprocess > :
public core_arch_operations< 4u, false, Interprocess >
{
typedef core_arch_operations< 4u, false, Interprocess > base_type;
typedef typename base_type::storage_type storage_type;
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
base_type::fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldl_l %0, %2\n\t"
"addl %0, %3, %1\n\t"
"zapnot %1, 1, %1\n\t"
"stl_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
base_type::fence_after(order);
return original;
}
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
base_type::fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldl_l %0, %2\n\t"
"subl %0, %3, %1\n\t"
"zapnot %1, 1, %1\n\t"
"stl_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
base_type::fence_after(order);
return original;
}
};
template< bool Interprocess >
struct core_arch_operations< 1u, true, Interprocess > :
public core_arch_operations< 4u, true, Interprocess >
{
typedef core_arch_operations< 4u, true, Interprocess > base_type;
typedef typename base_type::storage_type storage_type;
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
base_type::fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldl_l %0, %2\n\t"
"addl %0, %3, %1\n\t"
"sextb %1, %1\n\t"
"stl_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
base_type::fence_after(order);
return original;
}
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
base_type::fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldl_l %0, %2\n\t"
"subl %0, %3, %1\n\t"
"sextb %1, %1\n\t"
"stl_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
base_type::fence_after(order);
return original;
}
};
template< bool Interprocess >
struct core_arch_operations< 2u, false, Interprocess > :
public core_arch_operations< 4u, false, Interprocess >
{
typedef core_arch_operations< 4u, false, Interprocess > base_type;
typedef typename base_type::storage_type storage_type;
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
base_type::fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldl_l %0, %2\n\t"
"addl %0, %3, %1\n\t"
"zapnot %1, 3, %1\n\t"
"stl_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
base_type::fence_after(order);
return original;
}
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
base_type::fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldl_l %0, %2\n\t"
"subl %0, %3, %1\n\t"
"zapnot %1, 3, %1\n\t"
"stl_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
base_type::fence_after(order);
return original;
}
};
template< bool Interprocess >
struct core_arch_operations< 2u, true, Interprocess > :
public core_arch_operations< 4u, true, Interprocess >
{
typedef core_arch_operations< 4u, true, Interprocess > base_type;
typedef typename base_type::storage_type storage_type;
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
base_type::fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldl_l %0, %2\n\t"
"addl %0, %3, %1\n\t"
"sextw %1, %1\n\t"
"stl_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
base_type::fence_after(order);
return original;
}
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
base_type::fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldl_l %0, %2\n\t"
"subl %0, %3, %1\n\t"
"sextw %1, %1\n\t"
"stl_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
base_type::fence_after(order);
return original;
}
};
template< bool Signed, bool Interprocess >
struct core_arch_operations< 8u, Signed, Interprocess > :
public core_arch_operations_gcc_alpha_base
{
typedef typename storage_traits< 8u >::type storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 8u;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_alignment = 8u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
static BOOST_CONSTEXPR_OR_CONST bool is_interprocess = Interprocess;
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
fence_before(order);
storage = v;
fence_after_store(order);
}
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
{
storage_type v = storage;
fence_after(order);
return v;
}
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, tmp;
fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"mov %3, %1\n\t"
"ldq_l %0, %2\n\t"
"stq_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (tmp) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
fence_after(order);
return original;
}
static BOOST_FORCEINLINE bool compare_exchange_weak(
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
{
fence_before(success_order);
int success;
storage_type current;
__asm__ __volatile__
(
"1:\n\t"
"ldq_l %2, %4\n\t" // current = *(&storage)
"cmpeq %2, %0, %3\n\t" // success = current == expected
"mov %2, %0\n\t" // expected = current
"beq %3, 2f\n\t" // if (success == 0) goto end
"stq_c %1, %4\n\t" // storage = desired; desired = store succeeded
"mov %1, %3\n\t" // success = desired
"2:\n\t"
: "+r" (expected), // %0
"+r" (desired), // %1
"=&r" (current), // %2
"=&r" (success) // %3
: "m" (storage) // %4
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
if (success)
fence_after(success_order);
else
fence_after(failure_order);
return !!success;
}
static BOOST_FORCEINLINE bool compare_exchange_strong(
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
{
int success;
storage_type current, tmp;
fence_before(success_order);
__asm__ __volatile__
(
"1:\n\t"
"mov %5, %1\n\t" // tmp = desired
"ldq_l %2, %4\n\t" // current = *(&storage)
"cmpeq %2, %0, %3\n\t" // success = current == expected
"mov %2, %0\n\t" // expected = current
"beq %3, 2f\n\t" // if (success == 0) goto end
"stq_c %1, %4\n\t" // storage = tmp; tmp = store succeeded
"beq %1, 3f\n\t" // if (tmp == 0) goto retry
"mov %1, %3\n\t" // success = tmp
"2:\n\t"
".subsection 2\n\t"
"3: br 1b\n\t"
".previous\n\t"
: "+r" (expected), // %0
"=&r" (tmp), // %1
"=&r" (current), // %2
"=&r" (success) // %3
: "m" (storage), // %4
"r" (desired) // %5
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
if (success)
fence_after(success_order);
else
fence_after(failure_order);
return !!success;
}
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldq_l %0, %2\n\t"
"addq %0, %3, %1\n\t"
"stq_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
fence_after(order);
return original;
}
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldq_l %0, %2\n\t"
"subq %0, %3, %1\n\t"
"stq_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
fence_after(order);
return original;
}
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldq_l %0, %2\n\t"
"and %0, %3, %1\n\t"
"stq_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
fence_after(order);
return original;
}
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldq_l %0, %2\n\t"
"bis %0, %3, %1\n\t"
"stq_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
fence_after(order);
return original;
}
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
storage_type original, modified;
fence_before(order);
__asm__ __volatile__
(
"1:\n\t"
"ldq_l %0, %2\n\t"
"xor %0, %3, %1\n\t"
"stq_c %1, %2\n\t"
"beq %1, 2f\n\t"
".subsection 2\n\t"
"2: br 1b\n\t"
".previous\n\t"
: "=&r" (original), // %0
"=&r" (modified) // %1
: "m" (storage), // %2
"r" (v) // %3
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
);
fence_after(order);
return original;
}
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
{
return !!exchange(storage, (storage_type)1, order);
}
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
{
store(storage, (storage_type)0, order);
}
};
} // namespace detail
} // namespace atomics
} // namespace boost
#include <boost/atomic/detail/footer.hpp>
#endif // BOOST_ATOMIC_DETAIL_CORE_ARCH_OPS_GCC_ALPHA_HPP_INCLUDED_
```
|
```objective-c
//
// Printf variants that place their output in a C++ string.
//
// Usage:
// string result = StringPrintf("%d %s\n", 10, "hello");
// SStringPrintf(&result, "%d %s\n", 10, "hello");
// StringAppendF(&result, "%d %s\n", 20, "there");
#ifndef _BASE_STRINGPRINTF_H
#define _BASE_STRINGPRINTF_H
#include <stdarg.h>
#include <string>
#include <vector>
#include "kudu/gutil/port.h"
// Return a C++ string
extern std::string StringPrintf(const char* format, ...)
// Tell the compiler to do printf format string checking.
PRINTF_ATTRIBUTE(1,2);
// Store result into a supplied string and return it
extern const std::string& SStringPrintf(std::string* dst, const char* format, ...)
// Tell the compiler to do printf format string checking.
PRINTF_ATTRIBUTE(2,3);
// Append result to a supplied string
extern void StringAppendF(std::string* dst, const char* format, ...)
// Tell the compiler to do printf format string checking.
PRINTF_ATTRIBUTE(2,3);
// Lower-level routine that takes a va_list and appends to a specified
// string. All other routines are just convenience wrappers around it.
extern void StringAppendV(std::string* dst, const char* format, va_list ap);
// The max arguments supported by StringPrintfVector
extern const int kStringPrintfVectorMaxArgs;
// You can use this version when all your arguments are strings, but
// you don't know how many arguments you'll have at compile time.
// StringPrintfVector will LOG(FATAL) if v.size() > kStringPrintfVectorMaxArgs
extern std::string StringPrintfVector(const char* format, const std::vector<std::string>& v);
#endif /* _BASE_STRINGPRINTF_H */
```
|
```forth
PROGRAM SBLAT1
* Test program for the REAL Level 1 BLAS.
* Based upon the original BLAS test routine together with:
* F06EAF Example Program Text
* .. Parameters ..
INTEGER NOUT
PARAMETER (NOUT=6)
* .. Scalars in Common ..
INTEGER ICASE, INCX, INCY, MODE, N
LOGICAL PASS
* .. Local Scalars ..
REAL SFAC
INTEGER IC
* .. External Subroutines ..
EXTERNAL CHECK0, CHECK1, CHECK2, CHECK3, HEADER
* .. Common blocks ..
COMMON /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
* .. Data statements ..
DATA SFAC/9.765625E-4/
* .. Executable Statements ..
WRITE (NOUT,99999)
DO 20 IC = 1, 10
ICASE = IC
CALL HEADER
*
* .. Initialize PASS, INCX, INCY, and MODE for a new case. ..
* .. the value 9999 for INCX, INCY or MODE will appear in the ..
* .. detailed output, if any, for cases that do not involve ..
* .. these parameters ..
*
PASS = .TRUE.
INCX = 9999
INCY = 9999
MODE = 9999
IF (ICASE.EQ.3) THEN
CALL CHECK0(SFAC)
ELSE IF (ICASE.EQ.7 .OR. ICASE.EQ.8 .OR. ICASE.EQ.9 .OR.
+ ICASE.EQ.10) THEN
CALL CHECK1(SFAC)
ELSE IF (ICASE.EQ.1 .OR. ICASE.EQ.2 .OR. ICASE.EQ.5 .OR.
+ ICASE.EQ.6) THEN
CALL CHECK2(SFAC)
ELSE IF (ICASE.EQ.4) THEN
CALL CHECK3(SFAC)
END IF
* -- Print
IF (PASS) WRITE (NOUT,99998)
20 CONTINUE
STOP
*
99999 FORMAT (' Real BLAS Test Program Results',/1X)
99998 FORMAT (' ----- PASS -----')
END
SUBROUTINE HEADER
* .. Parameters ..
INTEGER NOUT
PARAMETER (NOUT=6)
* .. Scalars in Common ..
INTEGER ICASE, INCX, INCY, MODE, N
LOGICAL PASS
* .. Local Arrays ..
CHARACTER*6 L(10)
* .. Common blocks ..
COMMON /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
* .. Data statements ..
DATA L(1)/' SDOT '/
DATA L(2)/'SAXPY '/
DATA L(3)/'SROTG '/
DATA L(4)/' SROT '/
DATA L(5)/'SCOPY '/
DATA L(6)/'SSWAP '/
DATA L(7)/'SNRM2 '/
DATA L(8)/'SASUM '/
DATA L(9)/'SSCAL '/
DATA L(10)/'ISAMAX'/
* .. Executable Statements ..
WRITE (NOUT,99999) ICASE, L(ICASE)
RETURN
*
99999 FORMAT (/' Test of subprogram number',I3,12X,A6)
END
SUBROUTINE CHECK0(SFAC)
* .. Parameters ..
INTEGER NOUT
PARAMETER (NOUT=6)
* .. Scalar Arguments ..
REAL SFAC
* .. Scalars in Common ..
INTEGER ICASE, INCX, INCY, MODE, N
LOGICAL PASS
* .. Local Scalars ..
REAL D12, SA, SB, SC, SS
INTEGER K
* .. Local Arrays ..
REAL DA1(8), DATRUE(8), DB1(8), DBTRUE(8), DC1(8),
+ DS1(8)
* .. External Subroutines ..
EXTERNAL SROTG, STEST1
* .. Common blocks ..
COMMON /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
* .. Data statements ..
DATA DA1/0.3E0, 0.4E0, -0.3E0, -0.4E0, -0.3E0, 0.0E0,
+ 0.0E0, 1.0E0/
DATA DB1/0.4E0, 0.3E0, 0.4E0, 0.3E0, -0.4E0, 0.0E0,
+ 1.0E0, 0.0E0/
DATA DC1/0.6E0, 0.8E0, -0.6E0, 0.8E0, 0.6E0, 1.0E0,
+ 0.0E0, 1.0E0/
DATA DS1/0.8E0, 0.6E0, 0.8E0, -0.6E0, 0.8E0, 0.0E0,
+ 1.0E0, 0.0E0/
DATA DATRUE/0.5E0, 0.5E0, 0.5E0, -0.5E0, -0.5E0,
+ 0.0E0, 1.0E0, 1.0E0/
DATA DBTRUE/0.0E0, 0.6E0, 0.0E0, -0.6E0, 0.0E0,
+ 0.0E0, 1.0E0, 0.0E0/
DATA D12/4096.0E0/
* .. Executable Statements ..
*
* Compute true values which cannot be prestored
* in decimal notation
*
DBTRUE(1) = 1.0E0/0.6E0
DBTRUE(3) = -1.0E0/0.6E0
DBTRUE(5) = 1.0E0/0.6E0
*
DO 20 K = 1, 8
* .. Set N=K for identification in output if any ..
N = K
IF (ICASE.EQ.3) THEN
* .. SROTG ..
IF (K.GT.8) GO TO 40
SA = DA1(K)
SB = DB1(K)
CALL SROTG(SA,SB,SC,SS)
CALL STEST1(SA,DATRUE(K),DATRUE(K),SFAC)
CALL STEST1(SB,DBTRUE(K),DBTRUE(K),SFAC)
CALL STEST1(SC,DC1(K),DC1(K),SFAC)
CALL STEST1(SS,DS1(K),DS1(K),SFAC)
ELSE
WRITE (NOUT,*) ' Shouldn''t be here in CHECK0'
STOP
END IF
20 CONTINUE
40 RETURN
END
SUBROUTINE CHECK1(SFAC)
* .. Parameters ..
INTEGER NOUT
PARAMETER (NOUT=6)
* .. Scalar Arguments ..
REAL SFAC
* .. Scalars in Common ..
INTEGER ICASE, INCX, INCY, MODE, N
LOGICAL PASS
* .. Local Scalars ..
INTEGER I, LEN, NP1
* .. Local Arrays ..
REAL DTRUE1(5), DTRUE3(5), DTRUE5(8,5,2), DV(8,5,2),
+ SA(10), STEMP(1), STRUE(8), SX(8)
INTEGER ITRUE2(5)
* .. External Functions ..
REAL SASUM, SNRM2
INTEGER ISAMAX
EXTERNAL SASUM, SNRM2, ISAMAX
* .. External Subroutines ..
EXTERNAL ITEST1, SSCAL, STEST, STEST1
* .. Intrinsic Functions ..
INTRINSIC MAX
* .. Common blocks ..
COMMON /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
* .. Data statements ..
DATA SA/0.3E0, -1.0E0, 0.0E0, 1.0E0, 0.3E0, 0.3E0,
+ 0.3E0, 0.3E0, 0.3E0, 0.3E0/
DATA DV/0.1E0, 2.0E0, 2.0E0, 2.0E0, 2.0E0, 2.0E0,
+ 2.0E0, 2.0E0, 0.3E0, 3.0E0, 3.0E0, 3.0E0, 3.0E0,
+ 3.0E0, 3.0E0, 3.0E0, 0.3E0, -0.4E0, 4.0E0,
+ 4.0E0, 4.0E0, 4.0E0, 4.0E0, 4.0E0, 0.2E0,
+ -0.6E0, 0.3E0, 5.0E0, 5.0E0, 5.0E0, 5.0E0,
+ 5.0E0, 0.1E0, -0.3E0, 0.5E0, -0.1E0, 6.0E0,
+ 6.0E0, 6.0E0, 6.0E0, 0.1E0, 8.0E0, 8.0E0, 8.0E0,
+ 8.0E0, 8.0E0, 8.0E0, 8.0E0, 0.3E0, 9.0E0, 9.0E0,
+ 9.0E0, 9.0E0, 9.0E0, 9.0E0, 9.0E0, 0.3E0, 2.0E0,
+ -0.4E0, 2.0E0, 2.0E0, 2.0E0, 2.0E0, 2.0E0,
+ 0.2E0, 3.0E0, -0.6E0, 5.0E0, 0.3E0, 2.0E0,
+ 2.0E0, 2.0E0, 0.1E0, 4.0E0, -0.3E0, 6.0E0,
+ -0.5E0, 7.0E0, -0.1E0, 3.0E0/
DATA DTRUE1/0.0E0, 0.3E0, 0.5E0, 0.7E0, 0.6E0/
DATA DTRUE3/0.0E0, 0.3E0, 0.7E0, 1.1E0, 1.0E0/
DATA DTRUE5/0.10E0, 2.0E0, 2.0E0, 2.0E0, 2.0E0,
+ 2.0E0, 2.0E0, 2.0E0, -0.3E0, 3.0E0, 3.0E0,
+ 3.0E0, 3.0E0, 3.0E0, 3.0E0, 3.0E0, 0.0E0, 0.0E0,
+ 4.0E0, 4.0E0, 4.0E0, 4.0E0, 4.0E0, 4.0E0,
+ 0.20E0, -0.60E0, 0.30E0, 5.0E0, 5.0E0, 5.0E0,
+ 5.0E0, 5.0E0, 0.03E0, -0.09E0, 0.15E0, -0.03E0,
+ 6.0E0, 6.0E0, 6.0E0, 6.0E0, 0.10E0, 8.0E0,
+ 8.0E0, 8.0E0, 8.0E0, 8.0E0, 8.0E0, 8.0E0,
+ 0.09E0, 9.0E0, 9.0E0, 9.0E0, 9.0E0, 9.0E0,
+ 9.0E0, 9.0E0, 0.09E0, 2.0E0, -0.12E0, 2.0E0,
+ 2.0E0, 2.0E0, 2.0E0, 2.0E0, 0.06E0, 3.0E0,
+ -0.18E0, 5.0E0, 0.09E0, 2.0E0, 2.0E0, 2.0E0,
+ 0.03E0, 4.0E0, -0.09E0, 6.0E0, -0.15E0, 7.0E0,
+ -0.03E0, 3.0E0/
DATA ITRUE2/0, 1, 2, 2, 3/
* .. Executable Statements ..
DO 80 INCX = 1, 2
DO 60 NP1 = 1, 5
N = NP1 - 1
LEN = 2*MAX(N,1)
* .. Set vector arguments ..
DO 20 I = 1, LEN
SX(I) = DV(I,NP1,INCX)
20 CONTINUE
*
IF (ICASE.EQ.7) THEN
* .. SNRM2 ..
STEMP(1) = DTRUE1(NP1)
CALL STEST1(SNRM2(N,SX,INCX),STEMP,STEMP,SFAC)
ELSE IF (ICASE.EQ.8) THEN
* .. SASUM ..
STEMP(1) = DTRUE3(NP1)
CALL STEST1(SASUM(N,SX,INCX),STEMP,STEMP,SFAC)
ELSE IF (ICASE.EQ.9) THEN
* .. SSCAL ..
CALL SSCAL(N,SA((INCX-1)*5+NP1),SX,INCX)
DO 40 I = 1, LEN
STRUE(I) = DTRUE5(I,NP1,INCX)
40 CONTINUE
CALL STEST(LEN,SX,STRUE,STRUE,SFAC)
ELSE IF (ICASE.EQ.10) THEN
* .. ISAMAX ..
CALL ITEST1(ISAMAX(N,SX,INCX),ITRUE2(NP1))
ELSE
WRITE (NOUT,*) ' Shouldn''t be here in CHECK1'
STOP
END IF
60 CONTINUE
80 CONTINUE
RETURN
END
SUBROUTINE CHECK2(SFAC)
* .. Parameters ..
INTEGER NOUT
PARAMETER (NOUT=6)
* .. Scalar Arguments ..
REAL SFAC
* .. Scalars in Common ..
INTEGER ICASE, INCX, INCY, MODE, N
LOGICAL PASS
* .. Local Scalars ..
REAL SA, SC, SS
INTEGER I, J, KI, KN, KSIZE, LENX, LENY, MX, MY
* .. Local Arrays ..
REAL DT10X(7,4,4), DT10Y(7,4,4), DT7(4,4),
+ DT8(7,4,4), DT9X(7,4,4), DT9Y(7,4,4), DX1(7),
+ DY1(7), SSIZE1(4), SSIZE2(14,2), STX(7), STY(7),
+ SX(7), SY(7)
INTEGER INCXS(4), INCYS(4), LENS(4,2), NS(4)
* .. External Functions ..
REAL SDOT
EXTERNAL SDOT
* .. External Subroutines ..
EXTERNAL SAXPY, SCOPY, SSWAP, STEST, STEST1
* .. Intrinsic Functions ..
INTRINSIC ABS, MIN
* .. Common blocks ..
COMMON /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
* .. Data statements ..
DATA SA/0.3E0/
DATA INCXS/1, 2, -2, -1/
DATA INCYS/1, -2, 1, -2/
DATA LENS/1, 1, 2, 4, 1, 1, 3, 7/
DATA NS/0, 1, 2, 4/
DATA DX1/0.6E0, 0.1E0, -0.5E0, 0.8E0, 0.9E0, -0.3E0,
+ -0.4E0/
DATA DY1/0.5E0, -0.9E0, 0.3E0, 0.7E0, -0.6E0, 0.2E0,
+ 0.8E0/
DATA SC, SS/0.8E0, 0.6E0/
DATA DT7/0.0E0, 0.30E0, 0.21E0, 0.62E0, 0.0E0,
+ 0.30E0, -0.07E0, 0.85E0, 0.0E0, 0.30E0, -0.79E0,
+ -0.74E0, 0.0E0, 0.30E0, 0.33E0, 1.27E0/
DATA DT8/0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.68E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.68E0, -0.87E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.68E0, -0.87E0, 0.15E0,
+ 0.94E0, 0.0E0, 0.0E0, 0.0E0, 0.5E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.68E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.35E0, -0.9E0, 0.48E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.38E0, -0.9E0, 0.57E0, 0.7E0, -0.75E0,
+ 0.2E0, 0.98E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.68E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.35E0, -0.72E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.38E0,
+ -0.63E0, 0.15E0, 0.88E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.68E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.68E0, -0.9E0, 0.33E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.68E0, -0.9E0, 0.33E0, 0.7E0,
+ -0.75E0, 0.2E0, 1.04E0/
DATA DT9X/0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.78E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.78E0, -0.46E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.78E0, -0.46E0, -0.22E0,
+ 1.06E0, 0.0E0, 0.0E0, 0.0E0, 0.6E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.78E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.66E0, 0.1E0, -0.1E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.96E0, 0.1E0, -0.76E0, 0.8E0, 0.90E0,
+ -0.3E0, -0.02E0, 0.6E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.78E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, -0.06E0, 0.1E0,
+ -0.1E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.90E0,
+ 0.1E0, -0.22E0, 0.8E0, 0.18E0, -0.3E0, -0.02E0,
+ 0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.78E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.78E0, 0.26E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.78E0, 0.26E0, -0.76E0, 1.12E0,
+ 0.0E0, 0.0E0, 0.0E0/
DATA DT9Y/0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.04E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.04E0, -0.78E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.04E0, -0.78E0, 0.54E0,
+ 0.08E0, 0.0E0, 0.0E0, 0.0E0, 0.5E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.04E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.7E0,
+ -0.9E0, -0.12E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.64E0, -0.9E0, -0.30E0, 0.7E0, -0.18E0, 0.2E0,
+ 0.28E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.04E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.7E0, -1.08E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.64E0, -1.26E0,
+ 0.54E0, 0.20E0, 0.0E0, 0.0E0, 0.0E0, 0.5E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.04E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.04E0, -0.9E0, 0.18E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.04E0, -0.9E0, 0.18E0, 0.7E0,
+ -0.18E0, 0.2E0, 0.16E0/
DATA DT10X/0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.5E0, -0.9E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.5E0, -0.9E0, 0.3E0, 0.7E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.6E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.3E0, 0.1E0, 0.5E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.8E0, 0.1E0, -0.6E0,
+ 0.8E0, 0.3E0, -0.3E0, 0.5E0, 0.6E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.5E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, -0.9E0,
+ 0.1E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.7E0,
+ 0.1E0, 0.3E0, 0.8E0, -0.9E0, -0.3E0, 0.5E0,
+ 0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.5E0, 0.3E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.5E0, 0.3E0, -0.6E0, 0.8E0, 0.0E0, 0.0E0,
+ 0.0E0/
DATA DT10Y/0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.6E0, 0.1E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.6E0, 0.1E0, -0.5E0, 0.8E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, -0.5E0, -0.9E0, 0.6E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, -0.4E0, -0.9E0, 0.9E0,
+ 0.7E0, -0.5E0, 0.2E0, 0.6E0, 0.5E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.6E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, -0.5E0,
+ 0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ -0.4E0, 0.9E0, -0.5E0, 0.6E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.6E0, -0.9E0, 0.1E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.6E0, -0.9E0, 0.1E0, 0.7E0,
+ -0.5E0, 0.2E0, 0.8E0/
DATA SSIZE1/0.0E0, 0.3E0, 1.6E0, 3.2E0/
DATA SSIZE2/0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0,
+ 1.17E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0,
+ 1.17E0, 1.17E0, 1.17E0/
* .. Executable Statements ..
*
DO 120 KI = 1, 4
INCX = INCXS(KI)
INCY = INCYS(KI)
MX = ABS(INCX)
MY = ABS(INCY)
*
DO 100 KN = 1, 4
N = NS(KN)
KSIZE = MIN(2,KN)
LENX = LENS(KN,MX)
LENY = LENS(KN,MY)
* .. Initialize all argument arrays ..
DO 20 I = 1, 7
SX(I) = DX1(I)
SY(I) = DY1(I)
20 CONTINUE
*
IF (ICASE.EQ.1) THEN
* .. SDOT ..
CALL STEST1(SDOT(N,SX,INCX,SY,INCY),DT7(KN,KI),SSIZE1(KN)
+ ,SFAC)
ELSE IF (ICASE.EQ.2) THEN
* .. SAXPY ..
CALL SAXPY(N,SA,SX,INCX,SY,INCY)
DO 40 J = 1, LENY
STY(J) = DT8(J,KN,KI)
40 CONTINUE
CALL STEST(LENY,SY,STY,SSIZE2(1,KSIZE),SFAC)
ELSE IF (ICASE.EQ.5) THEN
* .. SCOPY ..
DO 60 I = 1, 7
STY(I) = DT10Y(I,KN,KI)
60 CONTINUE
CALL SCOPY(N,SX,INCX,SY,INCY)
CALL STEST(LENY,SY,STY,SSIZE2(1,1),1.0E0)
ELSE IF (ICASE.EQ.6) THEN
* .. SSWAP ..
CALL SSWAP(N,SX,INCX,SY,INCY)
DO 80 I = 1, 7
STX(I) = DT10X(I,KN,KI)
STY(I) = DT10Y(I,KN,KI)
80 CONTINUE
CALL STEST(LENX,SX,STX,SSIZE2(1,1),1.0E0)
CALL STEST(LENY,SY,STY,SSIZE2(1,1),1.0E0)
ELSE
WRITE (NOUT,*) ' Shouldn''t be here in CHECK2'
STOP
END IF
100 CONTINUE
120 CONTINUE
RETURN
END
SUBROUTINE CHECK3(SFAC)
* .. Parameters ..
INTEGER NOUT
PARAMETER (NOUT=6)
* .. Scalar Arguments ..
REAL SFAC
* .. Scalars in Common ..
INTEGER ICASE, INCX, INCY, MODE, N
LOGICAL PASS
* .. Local Scalars ..
REAL SA, SC, SS
INTEGER I, K, KI, KN, KSIZE, LENX, LENY, MX, MY
* .. Local Arrays ..
REAL COPYX(5), COPYY(5), DT9X(7,4,4), DT9Y(7,4,4),
+ DX1(7), DY1(7), MWPC(11), MWPS(11), MWPSTX(5),
+ MWPSTY(5), MWPTX(11,5), MWPTY(11,5), MWPX(5),
+ MWPY(5), SSIZE2(14,2), STX(7), STY(7), SX(7),
+ SY(7)
INTEGER INCXS(4), INCYS(4), LENS(4,2), MWPINX(11),
+ MWPINY(11), MWPN(11), NS(4)
* .. External Subroutines ..
EXTERNAL SROT, STEST
* .. Intrinsic Functions ..
INTRINSIC ABS, MIN
* .. Common blocks ..
COMMON /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
* .. Data statements ..
DATA SA/0.3E0/
DATA INCXS/1, 2, -2, -1/
DATA INCYS/1, -2, 1, -2/
DATA LENS/1, 1, 2, 4, 1, 1, 3, 7/
DATA NS/0, 1, 2, 4/
DATA DX1/0.6E0, 0.1E0, -0.5E0, 0.8E0, 0.9E0, -0.3E0,
+ -0.4E0/
DATA DY1/0.5E0, -0.9E0, 0.3E0, 0.7E0, -0.6E0, 0.2E0,
+ 0.8E0/
DATA SC, SS/0.8E0, 0.6E0/
DATA DT9X/0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.78E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.78E0, -0.46E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.78E0, -0.46E0, -0.22E0,
+ 1.06E0, 0.0E0, 0.0E0, 0.0E0, 0.6E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.78E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.66E0, 0.1E0, -0.1E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.96E0, 0.1E0, -0.76E0, 0.8E0, 0.90E0,
+ -0.3E0, -0.02E0, 0.6E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.78E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, -0.06E0, 0.1E0,
+ -0.1E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.90E0,
+ 0.1E0, -0.22E0, 0.8E0, 0.18E0, -0.3E0, -0.02E0,
+ 0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.78E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.78E0, 0.26E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.78E0, 0.26E0, -0.76E0, 1.12E0,
+ 0.0E0, 0.0E0, 0.0E0/
DATA DT9Y/0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.04E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.04E0, -0.78E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.04E0, -0.78E0, 0.54E0,
+ 0.08E0, 0.0E0, 0.0E0, 0.0E0, 0.5E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.04E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.7E0,
+ -0.9E0, -0.12E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.64E0, -0.9E0, -0.30E0, 0.7E0, -0.18E0, 0.2E0,
+ 0.28E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.04E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.7E0, -1.08E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.64E0, -1.26E0,
+ 0.54E0, 0.20E0, 0.0E0, 0.0E0, 0.0E0, 0.5E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.04E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.04E0, -0.9E0, 0.18E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.04E0, -0.9E0, 0.18E0, 0.7E0,
+ -0.18E0, 0.2E0, 0.16E0/
DATA SSIZE2/0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,
+ 0.0E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0,
+ 1.17E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0,
+ 1.17E0, 1.17E0, 1.17E0/
* .. Executable Statements ..
*
DO 60 KI = 1, 4
INCX = INCXS(KI)
INCY = INCYS(KI)
MX = ABS(INCX)
MY = ABS(INCY)
*
DO 40 KN = 1, 4
N = NS(KN)
KSIZE = MIN(2,KN)
LENX = LENS(KN,MX)
LENY = LENS(KN,MY)
*
IF (ICASE.EQ.4) THEN
* .. SROT ..
DO 20 I = 1, 7
SX(I) = DX1(I)
SY(I) = DY1(I)
STX(I) = DT9X(I,KN,KI)
STY(I) = DT9Y(I,KN,KI)
20 CONTINUE
CALL SROT(N,SX,INCX,SY,INCY,SC,SS)
CALL STEST(LENX,SX,STX,SSIZE2(1,KSIZE),SFAC)
CALL STEST(LENY,SY,STY,SSIZE2(1,KSIZE),SFAC)
ELSE
WRITE (NOUT,*) ' Shouldn''t be here in CHECK3'
STOP
END IF
40 CONTINUE
60 CONTINUE
*
MWPC(1) = 1
DO 80 I = 2, 11
MWPC(I) = 0
80 CONTINUE
MWPS(1) = 0
DO 100 I = 2, 6
MWPS(I) = 1
100 CONTINUE
DO 120 I = 7, 11
MWPS(I) = -1
120 CONTINUE
MWPINX(1) = 1
MWPINX(2) = 1
MWPINX(3) = 1
MWPINX(4) = -1
MWPINX(5) = 1
MWPINX(6) = -1
MWPINX(7) = 1
MWPINX(8) = 1
MWPINX(9) = -1
MWPINX(10) = 1
MWPINX(11) = -1
MWPINY(1) = 1
MWPINY(2) = 1
MWPINY(3) = -1
MWPINY(4) = -1
MWPINY(5) = 2
MWPINY(6) = 1
MWPINY(7) = 1
MWPINY(8) = -1
MWPINY(9) = -1
MWPINY(10) = 2
MWPINY(11) = 1
DO 140 I = 1, 11
MWPN(I) = 5
140 CONTINUE
MWPN(5) = 3
MWPN(10) = 3
DO 160 I = 1, 5
MWPX(I) = I
MWPY(I) = I
MWPTX(1,I) = I
MWPTY(1,I) = I
MWPTX(2,I) = I
MWPTY(2,I) = -I
MWPTX(3,I) = 6 - I
MWPTY(3,I) = I - 6
MWPTX(4,I) = I
MWPTY(4,I) = -I
MWPTX(6,I) = 6 - I
MWPTY(6,I) = I - 6
MWPTX(7,I) = -I
MWPTY(7,I) = I
MWPTX(8,I) = I - 6
MWPTY(8,I) = 6 - I
MWPTX(9,I) = -I
MWPTY(9,I) = I
MWPTX(11,I) = I - 6
MWPTY(11,I) = 6 - I
160 CONTINUE
MWPTX(5,1) = 1
MWPTX(5,2) = 3
MWPTX(5,3) = 5
MWPTX(5,4) = 4
MWPTX(5,5) = 5
MWPTY(5,1) = -1
MWPTY(5,2) = 2
MWPTY(5,3) = -2
MWPTY(5,4) = 4
MWPTY(5,5) = -3
MWPTX(10,1) = -1
MWPTX(10,2) = -3
MWPTX(10,3) = -5
MWPTX(10,4) = 4
MWPTX(10,5) = 5
MWPTY(10,1) = 1
MWPTY(10,2) = 2
MWPTY(10,3) = 2
MWPTY(10,4) = 4
MWPTY(10,5) = 3
DO 200 I = 1, 11
INCX = MWPINX(I)
INCY = MWPINY(I)
DO 180 K = 1, 5
COPYX(K) = MWPX(K)
COPYY(K) = MWPY(K)
MWPSTX(K) = MWPTX(I,K)
MWPSTY(K) = MWPTY(I,K)
180 CONTINUE
CALL SROT(MWPN(I),COPYX,INCX,COPYY,INCY,MWPC(I),MWPS(I))
CALL STEST(5,COPYX,MWPSTX,MWPSTX,SFAC)
CALL STEST(5,COPYY,MWPSTY,MWPSTY,SFAC)
200 CONTINUE
RETURN
END
SUBROUTINE STEST(LEN,SCOMP,STRUE,SSIZE,SFAC)
* ********************************* STEST **************************
*
* THIS SUBR COMPARES ARRAYS SCOMP() AND STRUE() OF LENGTH LEN TO
* SEE IF THE TERM BY TERM DIFFERENCES, MULTIPLIED BY SFAC, ARE
* NEGLIGIBLE.
*
* C. L. LAWSON, JPL, 1974 DEC 10
*
* .. Parameters ..
INTEGER NOUT
PARAMETER (NOUT=6)
* .. Scalar Arguments ..
REAL SFAC
INTEGER LEN
* .. Array Arguments ..
REAL SCOMP(LEN), SSIZE(LEN), STRUE(LEN)
* .. Scalars in Common ..
INTEGER ICASE, INCX, INCY, MODE, N
LOGICAL PASS
* .. Local Scalars ..
REAL SD
INTEGER I
* .. External Functions ..
REAL SDIFF
EXTERNAL SDIFF
* .. Intrinsic Functions ..
INTRINSIC ABS
* .. Common blocks ..
COMMON /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
* .. Executable Statements ..
*
DO 40 I = 1, LEN
SD = SCOMP(I) - STRUE(I)
IF (SDIFF(ABS(SSIZE(I))+ABS(SFAC*SD),ABS(SSIZE(I))).EQ.0.0E0)
+ GO TO 40
*
* HERE SCOMP(I) IS NOT CLOSE TO STRUE(I).
*
IF ( .NOT. PASS) GO TO 20
* PRINT FAIL MESSAGE AND HEADER.
PASS = .FALSE.
WRITE (NOUT,99999)
WRITE (NOUT,99998)
20 WRITE (NOUT,99997) ICASE, N, INCX, INCY, MODE, I, SCOMP(I),
+ STRUE(I), SD, SSIZE(I)
40 CONTINUE
RETURN
*
99999 FORMAT (' FAIL')
99998 FORMAT (/' CASE N INCX INCY MODE I ',
+ ' COMP(I) TRUE(I) DIFFERENCE',
+ ' SIZE(I)',/1X)
99997 FORMAT (1X,I4,I3,3I5,I3,2E36.8,2E12.4)
END
SUBROUTINE STEST1(SCOMP1,STRUE1,SSIZE,SFAC)
* ************************* STEST1 *****************************
*
* THIS IS AN INTERFACE SUBROUTINE TO ACCOMODATE THE FORTRAN
* REQUIREMENT THAT WHEN A DUMMY ARGUMENT IS AN ARRAY, THE
* ACTUAL ARGUMENT MUST ALSO BE AN ARRAY OR AN ARRAY ELEMENT.
*
* C.L. LAWSON, JPL, 1978 DEC 6
*
* .. Scalar Arguments ..
REAL SCOMP1, SFAC, STRUE1
* .. Array Arguments ..
REAL SSIZE(*)
* .. Local Arrays ..
REAL SCOMP(1), STRUE(1)
* .. External Subroutines ..
EXTERNAL STEST
* .. Executable Statements ..
*
SCOMP(1) = SCOMP1
STRUE(1) = STRUE1
CALL STEST(1,SCOMP,STRUE,SSIZE,SFAC)
*
RETURN
END
REAL FUNCTION SDIFF(SA,SB)
* ********************************* SDIFF **************************
* COMPUTES DIFFERENCE OF TWO NUMBERS. C. L. LAWSON, JPL 1974 FEB 15
*
* .. Scalar Arguments ..
REAL SA, SB
* .. Executable Statements ..
SDIFF = SA - SB
RETURN
END
SUBROUTINE ITEST1(ICOMP,ITRUE)
* ********************************* ITEST1 *************************
*
* THIS SUBROUTINE COMPARES THE VARIABLES ICOMP AND ITRUE FOR
* EQUALITY.
* C. L. LAWSON, JPL, 1974 DEC 10
*
* .. Parameters ..
INTEGER NOUT
PARAMETER (NOUT=6)
* .. Scalar Arguments ..
INTEGER ICOMP, ITRUE
* .. Scalars in Common ..
INTEGER ICASE, INCX, INCY, MODE, N
LOGICAL PASS
* .. Local Scalars ..
INTEGER ID
* .. Common blocks ..
COMMON /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
* .. Executable Statements ..
*
IF (ICOMP.EQ.ITRUE) GO TO 40
*
* HERE ICOMP IS NOT EQUAL TO ITRUE.
*
IF ( .NOT. PASS) GO TO 20
* PRINT FAIL MESSAGE AND HEADER.
PASS = .FALSE.
WRITE (NOUT,99999)
WRITE (NOUT,99998)
20 ID = ICOMP - ITRUE
WRITE (NOUT,99997) ICASE, N, INCX, INCY, MODE, ICOMP, ITRUE, ID
40 CONTINUE
RETURN
*
99999 FORMAT (' FAIL')
99998 FORMAT (/' CASE N INCX INCY MODE ',
+ ' COMP TRUE DIFFERENCE',
+ /1X)
99997 FORMAT (1X,I4,I3,3I5,2I36,I12)
END
```
|
```smalltalk
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LaserGRBL
{
public class MarlinCore : GrblCore
{
public MarlinCore(System.Windows.Forms.Control syncroObject, PreviewForm cbform, JogForm jogform) : base(syncroObject, cbform, jogform)
{
}
public override Firmware Type
{ get { return Firmware.Marlin; } }
// Send "M114\n" to retrieve position
// Typical response : "X:10.00 Y:0.00 Z:0.00 E:0.00 Count X:1600 Y:0 Z:0"
protected override void QueryPosition()
{
if (MachineStatus != MacStatus.Run)
com.Write("M114\n");
}
//protected override void ParseF(string p)
//{
// string sfs = p.Substring(2, p.Length - 2);
// string[] fs = sfs.Split(",".ToCharArray());
// SetFS(ParseFloat(fs[0]), ParseFloat(fs[1]));
//}
public override StreamingMode CurrentStreamingMode => StreamingMode.Synchronous;
public override bool UIShowGrblConfig => false;
public override bool UIShowUnlockButtons => false;
public override bool SupportTrueJogging => false;
internal override void SendUnlockCommand() { } //do nothing (should not be called because UI does not show unlock button)
protected override void SendBoardResetCommand() { }
protected override void ParseMachineStatus(string data)
{
MacStatus var = MacStatus.Disconnected;
if (data.Contains("ok"))
var = MacStatus.Idle;
//try { var = (MacStatus)Enum.Parse(typeof(MacStatus), data); }
//catch (Exception ex) { Logger.LogException("ParseMachineStatus", ex); }
if (InProgram && var == MacStatus.Idle) //bugfix for grbl sending Idle on G4
var = MacStatus.Run;
if (var == MacStatus.Hold && mHoldByCoolingRequest)
var = MacStatus.Cooling;
else if (var == MacStatus.Hold && !mHoldByUserRequest)
var = MacStatus.AutoHold;
SetStatus(var);
}
public override void RefreshConfig(RefreshCause cause)
{
}
public override void RefreshMachineInfo()
{
}
protected override void DetectHang()
{
if (mTP.LastIssue == DetectedIssue.Unknown && MachineStatus == MacStatus.Run && InProgram)
{
// Marlin does not answer to immediate command
// So we can not rise an issue if there is too many time before last call of ManageRealTimeStatus
// We rise the issue if the last response from the board was too long
// Original line :
//bool noQueryResponse = debugLastMoveDelay.ElapsedTime > TimeSpan.FromTicks(QueryTimer.Period.Ticks * 10) && debugLastStatusDelay.ElapsedTime > TimeSpan.FromSeconds(5);
// Marlin version :
bool noQueryResponse = debugLastMoveOrActivityDelay.ElapsedTime > TimeSpan.FromSeconds(10) && debugLastMoveOrActivityDelay.ElapsedTime > TimeSpan.FromTicks(QueryTimer.Period.Ticks * 10) && debugLastStatusDelay.ElapsedTime > TimeSpan.FromSeconds(5);
if (noQueryResponse)
SetIssue(DetectedIssue.StopResponding);
}
}
protected override void ManageReceivedLine(string rline)
{
if (IsMarlinRealTimeStatusMessage(rline))
ManageMarlinRealTimeStatus(rline);
else
base.ManageReceivedLine(rline);
}
private bool IsMarlinRealTimeStatusMessage(string rline) => rline.StartsWith("X:");
private void ManageMarlinRealTimeStatus(string rline)
{
try
{
debugLastStatusDelay.Start();
// Remove EOL
rline = rline.Trim(trimarray); //maybe not necessary (already done)
// Marlin M114 response :
// X:10.00 Y:0.00 Z:0.00 E:0.00 Count X:1600 Y:0 Z:0
// Split by space
string[] arr = rline.Split(" ".ToCharArray());
if (arr.Length > 0)
{
// Force update of status
ParseMachineStatus("ok");
// Retrieve position from data send by marlin
float x = float.Parse(arr[0].Split(":".ToCharArray())[1], System.Globalization.NumberFormatInfo.InvariantInfo);
float y = float.Parse(arr[1].Split(":".ToCharArray())[1], System.Globalization.NumberFormatInfo.InvariantInfo);
float z = float.Parse(arr[2].Split(":".ToCharArray())[1], System.Globalization.NumberFormatInfo.InvariantInfo);
SetMPosition(new GPoint(x, y, z));
}
}
catch (Exception ex)
{
Logger.LogMessage("ManageRealTimeStatus", "Ex on [{0}] message", rline);
Logger.LogException("ManageRealTimeStatus", ex);
}
}
// LaserGRBL don't ask status to marlin during code execution because there is no immediate command
// So LaserGRBL has to force the status at the end of programm execution
protected override void ForceStatusIdle ()
{
SetStatus(MacStatus.Idle);
}
}
}
```
|
```yaml
args:
- description: Subnet to use
name: subnet
required: true
comment: An Automation Script to return subnet broadcast address
commonfields:
id: IPCalcReturnSubnetBroadcastAddress
version: -1
name: IPCalcReturnSubnetBroadcastAddress
outputs:
- contextPath: IPCalc.IP.Address
description: Subnet addresses
type: String
script: '-'
subtype: python3
timeout: '0'
type: python
dockerimage: demisto/python3:3.10.14.100715
tests:
- No tests
fromversion: 6.0.0
```
|
Boston Cemetery is a cemetery located in Boston, Lincolnshire in England. The cemetery dates back to 1855 and was laid out by Darlington architect James Pigott Pritchett junior.
History
In 1854, a competition was held to design two chapels, a lodge and entrance gates for the new Boston Cemetery. The first prize was won by Pritchett & Sons of York, the firm of James Pigott Pritchett senior, but it was his son James Pigott Pritchett junior, who had just established his own firm in Darlington, who attended the meeting in July 1854 and was commissioned to prepare plans. He provided the layout for the grounds and plans for the twin chapels and a lodge, all in the gothic style.
The layout of the cemetery, lodge and Anglican chapel remain intact, though the nonconformist chapel was demolished in 1961.
Notable burials
Herbert Ingram, founder of The Illustrated London News
War Graves
The cemetery contains the war graves of 82 Commonwealth service personnel. There are 50 from World War I and 30 from World War II. The graves from the former war are scattered throughout the cemetery, most of those from the latter war are in a special war graves plot, behind which is a memorial to civilians of Boston who died by enemy action in the same war. There is also one non-war grave in the war graves plot.
One of the most curious graves is that of Major Walter George Burnett Dickinson FRSE FRCVS TD (1858–1914) who died of a heart attack 36 hours after the beginning of the First World War whilst requisitioning horses in the Boston area. Due to CWGC rules this still qualifies as an official "war death", making him, on paper at least, the first Major to die serving in the war.
Another grave is that of Linley Moreton Phillips, an Australian civilian prisoner of war in Ruhleben internment camp from 1914 to 1918, who died on ship returning to Boston.
References
External links
Boston Victorian Cemetery Trust
Boston Cemetery, Boston, Lincolnshire, England - Ennever/Enever
1855 establishments in England
Cemeteries established in the 1850s
Cemeteries in Lincolnshire
Commonwealth War Graves Commission cemeteries in England
Boston, Lincolnshire
|
```hcl
#
#
# path_to_url
#
# Unless required by applicable law or agreed to in writing, software
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
variable "project_id" {
description = "The project ID to host the bucket in"
}
variable "region" {
description = "The region to host the bucket in"
}
variable "cluster_prefix" {
description = "The prefix of existing GKE cluster"
}
variable "db_namespace" {
description = "The namespace of the vector database"
}
```
|
Omphalotropis gracilis is a species of minute salt marsh snail with an operculum, a terrestrial gastropod mollusk, or micromollusk, in the family Assimineidae. This species is endemic to Guam.
References
Fauna of Guam
Omphalotropis
Assimineidae
Gastropods described in 1894
Taxonomy articles created by Polbot
|
Emmanuel Hackman (born 14 May 1995) is a professional football player who plays for Turan Tovuz in the Azerbaijan Premier League. Born in Ghana, he plays for the Togo national team.
Club career
Hackman made his professional debut in the Primeira Liga for Boavista on 6 December 2015, coming on as a second-half substitute for Anderson Correia in a 2–3 loss to Arouca.
On 1 July 2021, Hackman signed a three-year contract with Gil Vicente.
International career
Hackman was born in Ghana to a Ghanaian Ewe father and Togolese mother. He was called up to the Togo national team for a set of friendlies in March 2022. He debuted for Togo in a 3–0 friendly win over Sierra Leone on 24 March 2022.
References
External links
1995 births
Footballers from Accra
Togolese people of Ghanaian descent
Ghanaian people of Togolese descent
Sportspeople of Ghanaian descent
Sportspeople of Togolese descent
Citizens of Togo through descent
Living people
Togolese men's footballers
Togo men's international footballers
Ghanaian men's footballers
Men's association football defenders
Liberty Professionals F.C. players
S.C. Vila Real players
Boavista F.C. players
C.D. Aves players
Portimonense S.C. players
Gil Vicente F.C. players
Primeira Liga players
Liga Portugal 2 players
Campeonato de Portugal (league) players
Serbian SuperLiga players
Togolese expatriate men's footballers
Ghanaian expatriate men's footballers
Expatriate men's footballers in Portugal
Togolese expatriate sportspeople in Portugal
Ghanaian expatriate sportspeople in Portugal
Expatriate men's footballers in Serbia
Togolese expatriate sportspeople in Serbia
Ghanaian expatriate sportspeople in Serbia
|
```smalltalk
namespace Bit.BlazorUI.Demo.Client.Core.Pages.Components.Surfaces.Tooltip;
public partial class BitTooltipDemo
{
private readonly List<ComponentParameter> componentParameters =
[
new()
{
Name = "Anchor",
Type = "RenderFragment?",
DefaultValue = "null",
Description = "Child content of component, the content that the Tooltip will apply to."
},
new()
{
Name = "ChildContent",
Type = "RenderFragment?",
DefaultValue = "null",
Description = "Child content of component, the content that the Tooltip will apply to."
},
new()
{
Name = "Classes",
Type = "BitTooltipClassStyles?",
DefaultValue = "null",
Description = "Custom CSS classes for different parts of the BitTooltip.",
LinkType = LinkType.Link,
Href = "#tooltip-class-styles"
},
new()
{
Name = "DefaultIsShown",
Type = "bool",
DefaultValue = "false",
Description = "Default value of the IsShown."
},
new()
{
Name = "HideArrow",
Type = "bool",
DefaultValue = "false",
Description = "Hides the arrow of tooltip."
},
new()
{
Name = "HideDelay",
Type = "int",
DefaultValue = "0",
Description = "Delay (in milliseconds) before hiding the tooltip."
},
new()
{
Name = "IsShown",
Type = "bool",
DefaultValue = "false",
Description = "The visibility state of the tooltip."
},
new()
{
Name = "IsShownChanged",
Type = "EventCallback<bool>",
DefaultValue = "",
Description = ""
},
new()
{
Name = "Position",
Type = "BitTooltipPosition",
DefaultValue = "BitTooltipPosition.Top",
Description = "The position of tooltip around its anchor.",
LinkType = LinkType.Link,
Href = "#tooltip-position-enum"
},
new()
{
Name = "Template",
Type = "RenderFragment?",
DefaultValue = "null",
Description = "The content you want inside the tooltip."
},
new()
{
Name = "Text",
Type = "string?",
DefaultValue = "null",
Description = "The text of tooltip to show."
},
new()
{
Name = "ShowOnClick",
Type = "bool",
DefaultValue = "false",
Description = "Determines shows tooltip on click."
},
new()
{
Name = "ShowDelay",
Type = "int",
DefaultValue = "0",
Description = "Delay (in milliseconds) before showing the tooltip."
},
new()
{
Name = "ShowOnFocus",
Type = "bool",
DefaultValue = "false",
Description = "Determines shows tooltip on focus."
},
new()
{
Name = "ShowOnHover",
Type = "bool",
DefaultValue = "true",
Description = "Determines shows tooltip on hover."
},
new()
{
Name = "Styles",
Type = "BitTooltipClassStyles?",
DefaultValue = "null",
Description = "Custom CSS styles for different parts of the BitTooltip.",
LinkType = LinkType.Link,
Href = "#tooltip-class-styles"
}
];
private readonly List<ComponentSubEnum> componentSubEnums =
[
new()
{
Id = "tooltip-position-enum",
Name = "BitTooltipPosition",
Description = "",
Items =
[
new()
{
Name = "Top",
Value = "0",
Description = "The position of tooltip top of its anchor"
},
new()
{
Name = "TopLeft",
Value = "1",
Description = "The position of tooltip top left of its anchor"
},
new()
{
Name = "TopRight",
Value = "2",
Description = "The position of tooltip top right of its anchor"
},
new()
{
Name = "RightTop",
Value = "3",
Description = "The position of tooltip right top of its anchor"
},
new()
{
Name = "Right",
Value = "4",
Description = "The position of tooltip right of its anchor"
},
new()
{
Name = "RightBottom",
Value = "5",
Description = "The position of tooltip right bottom of its anchor"
},
new()
{
Name = "BottomRight",
Value = "6",
Description = "The position of tooltip bottom right of its anchor"
},
new()
{
Name = "Bottom",
Value = "7",
Description = "The position of tooltip bottom of its anchor"
},
new()
{
Name = "BottomLeft",
Value = "8",
Description = "The position of tooltip bottom left of its anchor"
},
new()
{
Name = "LeftBottom",
Value = "9",
Description = "The position of tooltip left bottom of its anchor"
},
new()
{
Name = "Left",
Value = "10",
Description = "The position of tooltip left of its anchor"
},
new()
{
Name = "LeftTop",
Value = "11",
Description = "The position of tooltip left top of its anchor"
}
]
}
];
private readonly List<ComponentSubClass> componentSubClasses =
[
new()
{
Id = "tooltip-class-styles",
Title = "BitTooltipClassStyles",
Parameters =
[
new()
{
Name = "Root",
Type = "string?",
DefaultValue = "null",
Description = "Custom CSS classes/styles for the root element of the BitTooltip."
},
new()
{
Name = "TooltipWrapper",
Type = "string?",
DefaultValue = "null",
Description = "Custom CSS classes/styles for the tooltip wrapper of the BitTooltip."
},
new()
{
Name = "Tooltip",
Type = "string?",
DefaultValue = "null",
Description = "Custom CSS classes/styles for the tooltip of the BitTooltip."
},
new()
{
Name = "Arrow",
Type = "string?",
DefaultValue = "null",
Description = "Custom CSS classes/styles for the arrow of the BitTooltip."
}
]
}
];
private BitTooltipPosition tooltipPosition;
private List<BitDropdownItem<BitTooltipPosition>> tooltipPositionList = Enum.GetValues(typeof(BitTooltipPosition))
.Cast<BitTooltipPosition>()
.Select(enumValue => new BitDropdownItem<BitTooltipPosition>
{
Value = enumValue,
Text = enumValue.ToString()
})
.ToList();
private bool isShown = true;
private bool showOnClick = true;
private bool showOnHover;
private bool hideArrow;
private double hideDelay = 800;
private readonly string example1RazorCode = @"
<BitTooltip Text=""This is the tooltip text"">
<BitButton Variant=""BitVariant.Outline"">Hover over me</BitButton>
</BitTooltip>";
private readonly string example2RazorCode = @"
<BitTooltip DefaultIsShown=""true"" Text=""Text"" Position=""BitTooltipPosition.Top"">
<BitButton Variant=""BitVariant.Outline"">Top</BitButton>
</BitTooltip>
<BitTooltip DefaultIsShown=""true"" Text=""Text"" Position=""BitTooltipPosition.Right"">
<BitButton Variant=""BitVariant.Outline"">Right</BitButton>
</BitTooltip>
<BitTooltip DefaultIsShown=""true"" Text=""Text"" Position=""BitTooltipPosition.Left"">
<BitButton Variant=""BitVariant.Outline"">Left</BitButton>
</BitTooltip>
<BitTooltip DefaultIsShown=""true"" Text=""Text"" Position=""BitTooltipPosition.Bottom"">
<BitButton Variant=""BitVariant.Outline"">Bottom</BitButton>
</BitTooltip>";
private readonly string example3RazorCode = @"
<style>
.custom-class .custom-content {
gap: 0.5rem;
padding: 0.5rem;
color: blueviolet;
border-radius: 1rem;
display: inline-flex;
box-shadow: aqua 0 0 0.5rem;
}
.custom-root {
text-shadow: aqua 0 0 0.5rem;
}
.custom-tooltip {
color: tomato;
border: solid tomato;
border-radius: 0.5rem;
}
.custom-arrow {
border-right: solid tomato;
border-bottom: solid tomato;
}
</style>
<BitTooltip Text=""This is the tooltip text"" Class=""custom-class"">
<div class=""custom-content"">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
</div>
</BitTooltip>
<BitTooltip Text=""This is the tooltip text"" Styles=""@(new() { Tooltip = ""box-shadow: aqua 0 0 0.5rem;"" })"">
<BitButton Variant=""BitVariant.Outline"">Hover over me</BitButton>
</BitTooltip>
<BitTooltip Text=""This is the tooltip text""
Classes=""@(new() { Root = ""custom-root"",
Tooltip = ""custom-tooltip"",
Arrow = ""custom-arrow"" })"">
<BitButton Variant=""BitVariant.Outline"">Hover over me</BitButton>
</BitTooltip>";
private readonly string example4RazorCode = @"
<BitTooltip>
<Template>
<ul style=""padding: 0.5rem; margin: 0;"">
<li>1. One</li>
<li>2. Two</li>
</ul>
</Template>
<Anchor>
<BitButton Variant=""BitVariant.Outline"">Hover over me</BitButton>
</Anchor>
</BitTooltip>";
private readonly string example5RazorCode = @"
<BitTooltip Dir=""BitDir.Rtl"">
<Template>
<ul style=""padding: 0.5rem; margin: 0;"">
<li>. </li>
<li>. </li>
</ul>
</Template>
<Anchor>
<BitButton Variant=""BitVariant.Outline""> </BitButton>
</Anchor>
</BitTooltip>";
private readonly string example6RazorCode = @"
<BitTooltip @bind-IsShown=""isShown""
Text=""Text""
HideArrow=""hideArrow""
HideDelay=""(int)hideDelay""
ShowOnClick=""showOnClick""
ShowOnHover=""showOnHover""
Position=""tooltipPosition"">
<BitButton Variant=""BitVariant.Outline"">Anchor</BitButton>
</BitTooltip>
<BitDropdown Label=""Tooltip positions"" Items=""tooltipPositionList"" @bind-Value=""tooltipPosition"" />
<BitSpinButton Label=""Hide delay"" @bind-Value=""hideDelay"" Mode=""BitSpinButtonMode.Inline"" />
<BitToggle @bind-Value=""isShown"" DefaultText=""Toggle tooltip state"" />
<BitToggle @bind-Value=""hideArrow"" DefaultText=""Toggle tooltip arrow"" />
<BitToggle @bind-Value=""showOnClick"" DefaultText=""Show tooltip on click"" />
<BitToggle @bind-Value=""showOnHover"" DefaultText=""Show tooltip on hover"" />";
private readonly string example6CsharpCode = @"
private bool isShown = true;
private bool showOnClick = true;
private bool showOnHover;
private bool hideArrow;
private double hideDelay = 800;
private BitTooltipPosition tooltipPosition;
private List<BitDropdownItem<BitTooltipPosition>> tooltipPositionList = Enum.GetValues(typeof(BitTooltipPosition))
.Cast<BitTooltipPosition>()
.Select(enumValue => new BitDropdownItem<BitTooltipPosition>
{
Value = enumValue,
Text = enumValue.ToString()
})
.ToList();";
}
```
|
Diansi is a village in the Fara Department of Balé Province in southern Burkina Faso. The town has a total population of 182.
References
Populated places in the Boucle du Mouhoun Region
|
```objective-c
#pragma once
#include "reply.h"
namespace mbus {
/**
* An implementation of this interface is used by {@link SourceSession} to throttle output. Every message
* entering {@link SourceSession#send(Message)} needs to be accepted by this interface's {@link
* #canSend(Message, int)} method. All messages accepted are passed through the {@link
* #processMessage(Message)} method, and the corresponding replies are passed through the {@link
* #processReply(Reply)} method.
*/
class IThrottlePolicy {
public:
/**
* Convenience typedefs.
*/
using UP = std::unique_ptr<IThrottlePolicy>;
using SP = std::shared_ptr<IThrottlePolicy>;
/**
* Virtual destructor required for inheritance.
*/
virtual ~IThrottlePolicy() { /* empty */ }
/**
* Returns whether or not the given message can be sent according to the current state of this policy.
*
* @param msg The message to evaluate.
* @param pendingCount The current number of pending messages.
* @return True to send the message.
*/
virtual bool canSend(const Message &msg, uint32_t pendingCount) = 0;
/**
* This method is called once for every message that was accepted by {@link #canSend(Message, int)} and sent.
*
* @param msg The message beint sent.
*/
virtual void processMessage(Message &msg) = 0;
/**
* This method is called once for every reply that is received.
*
* @param reply The reply received.
*/
virtual void processReply(Reply &reply) = 0;
};
} // namespace mbus
```
|
```c++
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/execution/mips64/simulator-mips64.h"
// Only build the simulator if not compiling for real MIPS hardware.
#if defined(USE_SIMULATOR)
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
#include <cmath>
#include "src/base/bits.h"
#include "src/codegen/assembler-inl.h"
#include "src/codegen/macro-assembler.h"
#include "src/codegen/mips64/constants-mips64.h"
#include "src/diagnostics/disasm.h"
#include "src/heap/combined-heap.h"
#include "src/runtime/runtime-utils.h"
#include "src/utils/ostreams.h"
#include "src/utils/vector.h"
namespace v8 {
namespace internal {
DEFINE_LAZY_LEAKY_OBJECT_GETTER(Simulator::GlobalMonitor,
Simulator::GlobalMonitor::Get)
// Util functions.
inline bool HaveSameSign(int64_t a, int64_t b) { return ((a ^ b) >= 0); }
uint32_t get_fcsr_condition_bit(uint32_t cc) {
if (cc == 0) {
return 23;
} else {
return 24 + cc;
}
}
static int64_t MultiplyHighSigned(int64_t u, int64_t v) {
uint64_t u0, v0, w0;
int64_t u1, v1, w1, w2, t;
u0 = u & 0xFFFFFFFFL;
u1 = u >> 32;
v0 = v & 0xFFFFFFFFL;
v1 = v >> 32;
w0 = u0 * v0;
t = u1 * v0 + (w0 >> 32);
w1 = t & 0xFFFFFFFFL;
w2 = t >> 32;
w1 = u0 * v1 + w1;
return u1 * v1 + w2 + (w1 >> 32);
}
// This macro provides a platform independent use of sscanf. The reason for
// SScanF not being implemented in a platform independent was through
// ::v8::internal::OS in the same way as SNPrintF is that the Windows C Run-Time
// Library does not provide vsscanf.
#define SScanF sscanf // NOLINT
// The MipsDebugger class is used by the simulator while debugging simulated
// code.
class MipsDebugger {
public:
explicit MipsDebugger(Simulator* sim) : sim_(sim) {}
void Stop(Instruction* instr);
void Debug();
// Print all registers with a nice formatting.
void PrintAllRegs();
void PrintAllRegsIncludingFPU();
private:
// We set the breakpoint code to 0xFFFFF to easily recognize it.
static const Instr kBreakpointInstr = SPECIAL | BREAK | 0xFFFFF << 6;
static const Instr kNopInstr = 0x0;
Simulator* sim_;
int64_t GetRegisterValue(int regnum);
int64_t GetFPURegisterValue(int regnum);
float GetFPURegisterValueFloat(int regnum);
double GetFPURegisterValueDouble(int regnum);
bool GetValue(const char* desc, int64_t* value);
// Set or delete a breakpoint. Returns true if successful.
bool SetBreakpoint(Instruction* breakpc);
bool DeleteBreakpoint(Instruction* breakpc);
// Undo and redo all breakpoints. This is needed to bracket disassembly and
// execution to skip past breakpoints when run from the debugger.
void UndoBreakpoints();
void RedoBreakpoints();
};
inline void UNSUPPORTED() { printf("Sim: Unsupported instruction.\n"); }
void MipsDebugger::Stop(Instruction* instr) {
// Get the stop code.
uint32_t code = instr->Bits(25, 6);
PrintF("Simulator hit (%u)\n", code);
Debug();
}
int64_t MipsDebugger::GetRegisterValue(int regnum) {
if (regnum == kNumSimuRegisters) {
return sim_->get_pc();
} else {
return sim_->get_register(regnum);
}
}
int64_t MipsDebugger::GetFPURegisterValue(int regnum) {
if (regnum == kNumFPURegisters) {
return sim_->get_pc();
} else {
return sim_->get_fpu_register(regnum);
}
}
float MipsDebugger::GetFPURegisterValueFloat(int regnum) {
if (regnum == kNumFPURegisters) {
return sim_->get_pc();
} else {
return sim_->get_fpu_register_float(regnum);
}
}
double MipsDebugger::GetFPURegisterValueDouble(int regnum) {
if (regnum == kNumFPURegisters) {
return sim_->get_pc();
} else {
return sim_->get_fpu_register_double(regnum);
}
}
bool MipsDebugger::GetValue(const char* desc, int64_t* value) {
int regnum = Registers::Number(desc);
int fpuregnum = FPURegisters::Number(desc);
if (regnum != kInvalidRegister) {
*value = GetRegisterValue(regnum);
return true;
} else if (fpuregnum != kInvalidFPURegister) {
*value = GetFPURegisterValue(fpuregnum);
return true;
} else if (strncmp(desc, "0x", 2) == 0) {
return SScanF(desc + 2, "%" SCNx64, reinterpret_cast<uint64_t*>(value)) ==
1;
} else {
return SScanF(desc, "%" SCNu64, reinterpret_cast<uint64_t*>(value)) == 1;
}
return false;
}
bool MipsDebugger::SetBreakpoint(Instruction* breakpc) {
// Check if a breakpoint can be set. If not return without any side-effects.
if (sim_->break_pc_ != nullptr) {
return false;
}
// Set the breakpoint.
sim_->break_pc_ = breakpc;
sim_->break_instr_ = breakpc->InstructionBits();
// Not setting the breakpoint instruction in the code itself. It will be set
// when the debugger shell continues.
return true;
}
bool MipsDebugger::DeleteBreakpoint(Instruction* breakpc) {
if (sim_->break_pc_ != nullptr) {
sim_->break_pc_->SetInstructionBits(sim_->break_instr_);
}
sim_->break_pc_ = nullptr;
sim_->break_instr_ = 0;
return true;
}
void MipsDebugger::UndoBreakpoints() {
if (sim_->break_pc_ != nullptr) {
sim_->break_pc_->SetInstructionBits(sim_->break_instr_);
}
}
void MipsDebugger::RedoBreakpoints() {
if (sim_->break_pc_ != nullptr) {
sim_->break_pc_->SetInstructionBits(kBreakpointInstr);
}
}
void MipsDebugger::PrintAllRegs() {
#define REG_INFO(n) Registers::Name(n), GetRegisterValue(n), GetRegisterValue(n)
PrintF("\n");
// at, v0, a0.
PrintF("%3s: 0x%016" PRIx64 " %14" PRId64 "\t%3s: 0x%016" PRIx64 " %14" PRId64
"\t%3s: 0x%016" PRIx64 " %14" PRId64 "\n",
REG_INFO(1), REG_INFO(2), REG_INFO(4));
// v1, a1.
PrintF("%34s\t%3s: 0x%016" PRIx64 " %14" PRId64 " \t%3s: 0x%016" PRIx64
" %14" PRId64 " \n",
"", REG_INFO(3), REG_INFO(5));
// a2.
PrintF("%34s\t%34s\t%3s: 0x%016" PRIx64 " %14" PRId64 " \n", "", "",
REG_INFO(6));
// a3.
PrintF("%34s\t%34s\t%3s: 0x%016" PRIx64 " %14" PRId64 " \n", "", "",
REG_INFO(7));
PrintF("\n");
// a4-t3, s0-s7
for (int i = 0; i < 8; i++) {
PrintF("%3s: 0x%016" PRIx64 " %14" PRId64 " \t%3s: 0x%016" PRIx64
" %14" PRId64 " \n",
REG_INFO(8 + i), REG_INFO(16 + i));
}
PrintF("\n");
// t8, k0, LO.
PrintF("%3s: 0x%016" PRIx64 " %14" PRId64 " \t%3s: 0x%016" PRIx64
" %14" PRId64 " \t%3s: 0x%016" PRIx64 " %14" PRId64 " \n",
REG_INFO(24), REG_INFO(26), REG_INFO(32));
// t9, k1, HI.
PrintF("%3s: 0x%016" PRIx64 " %14" PRId64 " \t%3s: 0x%016" PRIx64
" %14" PRId64 " \t%3s: 0x%016" PRIx64 " %14" PRId64 " \n",
REG_INFO(25), REG_INFO(27), REG_INFO(33));
// sp, fp, gp.
PrintF("%3s: 0x%016" PRIx64 " %14" PRId64 " \t%3s: 0x%016" PRIx64
" %14" PRId64 " \t%3s: 0x%016" PRIx64 " %14" PRId64 " \n",
REG_INFO(29), REG_INFO(30), REG_INFO(28));
// pc.
PrintF("%3s: 0x%016" PRIx64 " %14" PRId64 " \t%3s: 0x%016" PRIx64
" %14" PRId64 " \n",
REG_INFO(31), REG_INFO(34));
#undef REG_INFO
}
void MipsDebugger::PrintAllRegsIncludingFPU() {
#define FPU_REG_INFO(n) \
FPURegisters::Name(n), GetFPURegisterValue(n), GetFPURegisterValueDouble(n)
PrintAllRegs();
PrintF("\n\n");
// f0, f1, f2, ... f31.
// TODO(plind): consider printing 2 columns for space efficiency.
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(0));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(1));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(2));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(3));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(4));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(5));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(6));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(7));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(8));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(9));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(10));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(11));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(12));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(13));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(14));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(15));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(16));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(17));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(18));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(19));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(20));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(21));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(22));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(23));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(24));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(25));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(26));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(27));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(28));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(29));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(30));
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n", FPU_REG_INFO(31));
#undef FPU_REG_INFO
}
void MipsDebugger::Debug() {
intptr_t last_pc = -1;
bool done = false;
#define COMMAND_SIZE 63
#define ARG_SIZE 255
#define STR(a) #a
#define XSTR(a) STR(a)
char cmd[COMMAND_SIZE + 1];
char arg1[ARG_SIZE + 1];
char arg2[ARG_SIZE + 1];
char* argv[3] = {cmd, arg1, arg2};
// Make sure to have a proper terminating character if reaching the limit.
cmd[COMMAND_SIZE] = 0;
arg1[ARG_SIZE] = 0;
arg2[ARG_SIZE] = 0;
// Undo all set breakpoints while running in the debugger shell. This will
// make them invisible to all commands.
UndoBreakpoints();
while (!done && (sim_->get_pc() != Simulator::end_sim_pc)) {
if (last_pc != sim_->get_pc()) {
disasm::NameConverter converter;
disasm::Disassembler dasm(converter);
// Use a reasonably large buffer.
v8::internal::EmbeddedVector<char, 256> buffer;
dasm.InstructionDecode(buffer, reinterpret_cast<byte*>(sim_->get_pc()));
PrintF(" 0x%016" PRIx64 " %s\n", sim_->get_pc(), buffer.begin());
last_pc = sim_->get_pc();
}
char* line = ReadLine("sim> ");
if (line == nullptr) {
break;
} else {
char* last_input = sim_->last_debugger_input();
if (strcmp(line, "\n") == 0 && last_input != nullptr) {
line = last_input;
} else {
// Ownership is transferred to sim_;
sim_->set_last_debugger_input(line);
}
// Use sscanf to parse the individual parts of the command line. At the
// moment no command expects more than two parameters.
int argc = SScanF(line,
"%" XSTR(COMMAND_SIZE) "s "
"%" XSTR(ARG_SIZE) "s "
"%" XSTR(ARG_SIZE) "s",
cmd, arg1, arg2);
if ((strcmp(cmd, "si") == 0) || (strcmp(cmd, "stepi") == 0)) {
Instruction* instr = reinterpret_cast<Instruction*>(sim_->get_pc());
if (!(instr->IsTrap()) ||
instr->InstructionBits() == rtCallRedirInstr) {
sim_->InstructionDecode(
reinterpret_cast<Instruction*>(sim_->get_pc()));
} else {
// Allow si to jump over generated breakpoints.
PrintF("/!\\ Jumping over generated breakpoint.\n");
sim_->set_pc(sim_->get_pc() + kInstrSize);
}
} else if ((strcmp(cmd, "c") == 0) || (strcmp(cmd, "cont") == 0)) {
// Execute the one instruction we broke at with breakpoints disabled.
sim_->InstructionDecode(reinterpret_cast<Instruction*>(sim_->get_pc()));
// Leave the debugger shell.
done = true;
} else if ((strcmp(cmd, "p") == 0) || (strcmp(cmd, "print") == 0)) {
if (argc == 2) {
int64_t value;
double dvalue;
if (strcmp(arg1, "all") == 0) {
PrintAllRegs();
} else if (strcmp(arg1, "allf") == 0) {
PrintAllRegsIncludingFPU();
} else {
int regnum = Registers::Number(arg1);
int fpuregnum = FPURegisters::Number(arg1);
if (regnum != kInvalidRegister) {
value = GetRegisterValue(regnum);
PrintF("%s: 0x%08" PRIx64 " %" PRId64 " \n", arg1, value,
value);
} else if (fpuregnum != kInvalidFPURegister) {
value = GetFPURegisterValue(fpuregnum);
dvalue = GetFPURegisterValueDouble(fpuregnum);
PrintF("%3s: 0x%016" PRIx64 " %16.4e\n",
FPURegisters::Name(fpuregnum), value, dvalue);
} else {
PrintF("%s unrecognized\n", arg1);
}
}
} else {
if (argc == 3) {
if (strcmp(arg2, "single") == 0) {
int64_t value;
float fvalue;
int fpuregnum = FPURegisters::Number(arg1);
if (fpuregnum != kInvalidFPURegister) {
value = GetFPURegisterValue(fpuregnum);
value &= 0xFFFFFFFFUL;
fvalue = GetFPURegisterValueFloat(fpuregnum);
PrintF("%s: 0x%08" PRIx64 " %11.4e\n", arg1, value, fvalue);
} else {
PrintF("%s unrecognized\n", arg1);
}
} else {
PrintF("print <fpu register> single\n");
}
} else {
PrintF("print <register> or print <fpu register> single\n");
}
}
} else if ((strcmp(cmd, "po") == 0) ||
(strcmp(cmd, "printobject") == 0)) {
if (argc == 2) {
int64_t value;
StdoutStream os;
if (GetValue(arg1, &value)) {
Object obj(value);
os << arg1 << ": \n";
#ifdef DEBUG
obj.Print(os);
os << "\n";
#else
os << Brief(obj) << "\n";
#endif
} else {
os << arg1 << " unrecognized\n";
}
} else {
PrintF("printobject <value>\n");
}
} else if (strcmp(cmd, "stack") == 0 || strcmp(cmd, "mem") == 0 ||
strcmp(cmd, "dump") == 0) {
int64_t* cur = nullptr;
int64_t* end = nullptr;
int next_arg = 1;
if (strcmp(cmd, "stack") == 0) {
cur = reinterpret_cast<int64_t*>(sim_->get_register(Simulator::sp));
} else { // Command "mem".
int64_t value;
if (!GetValue(arg1, &value)) {
PrintF("%s unrecognized\n", arg1);
continue;
}
cur = reinterpret_cast<int64_t*>(value);
next_arg++;
}
int64_t words;
if (argc == next_arg) {
words = 10;
} else {
if (!GetValue(argv[next_arg], &words)) {
words = 10;
}
}
end = cur + words;
bool skip_obj_print = (strcmp(cmd, "dump") == 0);
while (cur < end) {
PrintF(" 0x%012" PRIxPTR " : 0x%016" PRIx64 " %14" PRId64 " ",
reinterpret_cast<intptr_t>(cur), *cur, *cur);
Object obj(*cur);
Heap* current_heap = sim_->isolate_->heap();
if (!skip_obj_print) {
if (obj.IsSmi() ||
IsValidHeapObject(current_heap, HeapObject::cast(obj))) {
PrintF(" (");
if (obj.IsSmi()) {
PrintF("smi %d", Smi::ToInt(obj));
} else {
obj.ShortPrint();
}
PrintF(")");
}
}
PrintF("\n");
cur++;
}
} else if ((strcmp(cmd, "disasm") == 0) || (strcmp(cmd, "dpc") == 0) ||
(strcmp(cmd, "di") == 0)) {
disasm::NameConverter converter;
disasm::Disassembler dasm(converter);
// Use a reasonably large buffer.
v8::internal::EmbeddedVector<char, 256> buffer;
byte* cur = nullptr;
byte* end = nullptr;
if (argc == 1) {
cur = reinterpret_cast<byte*>(sim_->get_pc());
end = cur + (10 * kInstrSize);
} else if (argc == 2) {
int regnum = Registers::Number(arg1);
if (regnum != kInvalidRegister || strncmp(arg1, "0x", 2) == 0) {
// The argument is an address or a register name.
int64_t value;
if (GetValue(arg1, &value)) {
cur = reinterpret_cast<byte*>(value);
// Disassemble 10 instructions at <arg1>.
end = cur + (10 * kInstrSize);
}
} else {
// The argument is the number of instructions.
int64_t value;
if (GetValue(arg1, &value)) {
cur = reinterpret_cast<byte*>(sim_->get_pc());
// Disassemble <arg1> instructions.
end = cur + (value * kInstrSize);
}
}
} else {
int64_t value1;
int64_t value2;
if (GetValue(arg1, &value1) && GetValue(arg2, &value2)) {
cur = reinterpret_cast<byte*>(value1);
end = cur + (value2 * kInstrSize);
}
}
while (cur < end) {
dasm.InstructionDecode(buffer, cur);
PrintF(" 0x%08" PRIxPTR " %s\n", reinterpret_cast<intptr_t>(cur),
buffer.begin());
cur += kInstrSize;
}
} else if (strcmp(cmd, "gdb") == 0) {
PrintF("relinquishing control to gdb\n");
v8::base::OS::DebugBreak();
PrintF("regaining control from gdb\n");
} else if (strcmp(cmd, "break") == 0) {
if (argc == 2) {
int64_t value;
if (GetValue(arg1, &value)) {
if (!SetBreakpoint(reinterpret_cast<Instruction*>(value))) {
PrintF("setting breakpoint failed\n");
}
} else {
PrintF("%s unrecognized\n", arg1);
}
} else {
PrintF("break <address>\n");
}
} else if (strcmp(cmd, "del") == 0) {
if (!DeleteBreakpoint(nullptr)) {
PrintF("deleting breakpoint failed\n");
}
} else if (strcmp(cmd, "flags") == 0) {
PrintF("No flags on MIPS !\n");
} else if (strcmp(cmd, "stop") == 0) {
int64_t value;
intptr_t stop_pc = sim_->get_pc() - 2 * kInstrSize;
Instruction* stop_instr = reinterpret_cast<Instruction*>(stop_pc);
Instruction* msg_address =
reinterpret_cast<Instruction*>(stop_pc + kInstrSize);
if ((argc == 2) && (strcmp(arg1, "unstop") == 0)) {
// Remove the current stop.
if (sim_->IsStopInstruction(stop_instr)) {
stop_instr->SetInstructionBits(kNopInstr);
msg_address->SetInstructionBits(kNopInstr);
} else {
PrintF("Not at debugger stop.\n");
}
} else if (argc == 3) {
// Print information about all/the specified breakpoint(s).
if (strcmp(arg1, "info") == 0) {
if (strcmp(arg2, "all") == 0) {
PrintF("Stop information:\n");
for (uint32_t i = kMaxWatchpointCode + 1; i <= kMaxStopCode;
i++) {
sim_->PrintStopInfo(i);
}
} else if (GetValue(arg2, &value)) {
sim_->PrintStopInfo(value);
} else {
PrintF("Unrecognized argument.\n");
}
} else if (strcmp(arg1, "enable") == 0) {
// Enable all/the specified breakpoint(s).
if (strcmp(arg2, "all") == 0) {
for (uint32_t i = kMaxWatchpointCode + 1; i <= kMaxStopCode;
i++) {
sim_->EnableStop(i);
}
} else if (GetValue(arg2, &value)) {
sim_->EnableStop(value);
} else {
PrintF("Unrecognized argument.\n");
}
} else if (strcmp(arg1, "disable") == 0) {
// Disable all/the specified breakpoint(s).
if (strcmp(arg2, "all") == 0) {
for (uint32_t i = kMaxWatchpointCode + 1; i <= kMaxStopCode;
i++) {
sim_->DisableStop(i);
}
} else if (GetValue(arg2, &value)) {
sim_->DisableStop(value);
} else {
PrintF("Unrecognized argument.\n");
}
}
} else {
PrintF("Wrong usage. Use help command for more information.\n");
}
} else if ((strcmp(cmd, "stat") == 0) || (strcmp(cmd, "st") == 0)) {
// Print registers and disassemble.
PrintAllRegs();
PrintF("\n");
disasm::NameConverter converter;
disasm::Disassembler dasm(converter);
// Use a reasonably large buffer.
v8::internal::EmbeddedVector<char, 256> buffer;
byte* cur = nullptr;
byte* end = nullptr;
if (argc == 1) {
cur = reinterpret_cast<byte*>(sim_->get_pc());
end = cur + (10 * kInstrSize);
} else if (argc == 2) {
int64_t value;
if (GetValue(arg1, &value)) {
cur = reinterpret_cast<byte*>(value);
// no length parameter passed, assume 10 instructions
end = cur + (10 * kInstrSize);
}
} else {
int64_t value1;
int64_t value2;
if (GetValue(arg1, &value1) && GetValue(arg2, &value2)) {
cur = reinterpret_cast<byte*>(value1);
end = cur + (value2 * kInstrSize);
}
}
while (cur < end) {
dasm.InstructionDecode(buffer, cur);
PrintF(" 0x%08" PRIxPTR " %s\n", reinterpret_cast<intptr_t>(cur),
buffer.begin());
cur += kInstrSize;
}
} else if ((strcmp(cmd, "h") == 0) || (strcmp(cmd, "help") == 0)) {
PrintF("cont\n");
PrintF(" continue execution (alias 'c')\n");
PrintF("stepi\n");
PrintF(" step one instruction (alias 'si')\n");
PrintF("print <register>\n");
PrintF(" print register content (alias 'p')\n");
PrintF(" use register name 'all' to print all registers\n");
PrintF("printobject <register>\n");
PrintF(" print an object from a register (alias 'po')\n");
PrintF("stack [<words>]\n");
PrintF(" dump stack content, default dump 10 words)\n");
PrintF("mem <address> [<words>]\n");
PrintF(" dump memory content, default dump 10 words)\n");
PrintF("dump [<words>]\n");
PrintF(
" dump memory content without pretty printing JS objects, default "
"dump 10 words)\n");
PrintF("flags\n");
PrintF(" print flags\n");
PrintF("disasm [<instructions>]\n");
PrintF("disasm [<address/register>]\n");
PrintF("disasm [[<address/register>] <instructions>]\n");
PrintF(" disassemble code, default is 10 instructions\n");
PrintF(" from pc (alias 'di')\n");
PrintF("gdb\n");
PrintF(" enter gdb\n");
PrintF("break <address>\n");
PrintF(" set a break point on the address\n");
PrintF("del\n");
PrintF(" delete the breakpoint\n");
PrintF("stop feature:\n");
PrintF(" Description:\n");
PrintF(" Stops are debug instructions inserted by\n");
PrintF(" the Assembler::stop() function.\n");
PrintF(" When hitting a stop, the Simulator will\n");
PrintF(" stop and give control to the Debugger.\n");
PrintF(" All stop codes are watched:\n");
PrintF(" - They can be enabled / disabled: the Simulator\n");
PrintF(" will / won't stop when hitting them.\n");
PrintF(" - The Simulator keeps track of how many times they \n");
PrintF(" are met. (See the info command.) Going over a\n");
PrintF(" disabled stop still increases its counter. \n");
PrintF(" Commands:\n");
PrintF(" stop info all/<code> : print infos about number <code>\n");
PrintF(" or all stop(s).\n");
PrintF(" stop enable/disable all/<code> : enables / disables\n");
PrintF(" all or number <code> stop(s)\n");
PrintF(" stop unstop\n");
PrintF(" ignore the stop instruction at the current location\n");
PrintF(" from now on\n");
} else {
PrintF("Unknown command: %s\n", cmd);
}
}
}
// Add all the breakpoints back to stop execution and enter the debugger
// shell when hit.
RedoBreakpoints();
#undef COMMAND_SIZE
#undef ARG_SIZE
#undef STR
#undef XSTR
}
bool Simulator::ICacheMatch(void* one, void* two) {
DCHECK_EQ(reinterpret_cast<intptr_t>(one) & CachePage::kPageMask, 0);
DCHECK_EQ(reinterpret_cast<intptr_t>(two) & CachePage::kPageMask, 0);
return one == two;
}
static uint32_t ICacheHash(void* key) {
return static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key)) >> 2;
}
static bool AllOnOnePage(uintptr_t start, size_t size) {
intptr_t start_page = (start & ~CachePage::kPageMask);
intptr_t end_page = ((start + size) & ~CachePage::kPageMask);
return start_page == end_page;
}
void Simulator::set_last_debugger_input(char* input) {
DeleteArray(last_debugger_input_);
last_debugger_input_ = input;
}
void Simulator::SetRedirectInstruction(Instruction* instruction) {
instruction->SetInstructionBits(rtCallRedirInstr);
}
void Simulator::FlushICache(base::CustomMatcherHashMap* i_cache,
void* start_addr, size_t size) {
int64_t start = reinterpret_cast<int64_t>(start_addr);
int64_t intra_line = (start & CachePage::kLineMask);
start -= intra_line;
size += intra_line;
size = ((size - 1) | CachePage::kLineMask) + 1;
int offset = (start & CachePage::kPageMask);
while (!AllOnOnePage(start, size - 1)) {
int bytes_to_flush = CachePage::kPageSize - offset;
FlushOnePage(i_cache, start, bytes_to_flush);
start += bytes_to_flush;
size -= bytes_to_flush;
DCHECK_EQ((int64_t)0, start & CachePage::kPageMask);
offset = 0;
}
if (size != 0) {
FlushOnePage(i_cache, start, size);
}
}
CachePage* Simulator::GetCachePage(base::CustomMatcherHashMap* i_cache,
void* page) {
base::HashMap::Entry* entry = i_cache->LookupOrInsert(page, ICacheHash(page));
if (entry->value == nullptr) {
CachePage* new_page = new CachePage();
entry->value = new_page;
}
return reinterpret_cast<CachePage*>(entry->value);
}
// Flush from start up to and not including start + size.
void Simulator::FlushOnePage(base::CustomMatcherHashMap* i_cache,
intptr_t start, size_t size) {
DCHECK_LE(size, CachePage::kPageSize);
DCHECK(AllOnOnePage(start, size - 1));
DCHECK_EQ(start & CachePage::kLineMask, 0);
DCHECK_EQ(size & CachePage::kLineMask, 0);
void* page = reinterpret_cast<void*>(start & (~CachePage::kPageMask));
int offset = (start & CachePage::kPageMask);
CachePage* cache_page = GetCachePage(i_cache, page);
char* valid_bytemap = cache_page->ValidityByte(offset);
memset(valid_bytemap, CachePage::LINE_INVALID, size >> CachePage::kLineShift);
}
void Simulator::CheckICache(base::CustomMatcherHashMap* i_cache,
Instruction* instr) {
int64_t address = reinterpret_cast<int64_t>(instr);
void* page = reinterpret_cast<void*>(address & (~CachePage::kPageMask));
void* line = reinterpret_cast<void*>(address & (~CachePage::kLineMask));
int offset = (address & CachePage::kPageMask);
CachePage* cache_page = GetCachePage(i_cache, page);
char* cache_valid_byte = cache_page->ValidityByte(offset);
bool cache_hit = (*cache_valid_byte == CachePage::LINE_VALID);
char* cached_line = cache_page->CachedData(offset & ~CachePage::kLineMask);
if (cache_hit) {
// Check that the data in memory matches the contents of the I-cache.
CHECK_EQ(0, memcmp(reinterpret_cast<void*>(instr),
cache_page->CachedData(offset), kInstrSize));
} else {
// Cache miss. Load memory into the cache.
memcpy(cached_line, line, CachePage::kLineLength);
*cache_valid_byte = CachePage::LINE_VALID;
}
}
Simulator::Simulator(Isolate* isolate) : isolate_(isolate) {
// Set up simulator support first. Some of this information is needed to
// setup the architecture state.
stack_size_ = FLAG_sim_stack_size * KB;
stack_ = reinterpret_cast<char*>(malloc(stack_size_));
pc_modified_ = false;
icount_ = 0;
break_count_ = 0;
break_pc_ = nullptr;
break_instr_ = 0;
// Set up architecture state.
// All registers are initialized to zero to start with.
for (int i = 0; i < kNumSimuRegisters; i++) {
registers_[i] = 0;
}
for (int i = 0; i < kNumFPURegisters; i++) {
FPUregisters_[2 * i] = 0;
FPUregisters_[2 * i + 1] = 0; // upper part for MSA ASE
}
if (kArchVariant == kMips64r6) {
FCSR_ = kFCSRNaN2008FlagMask;
MSACSR_ = 0;
} else {
FCSR_ = 0;
}
// The sp is initialized to point to the bottom (high address) of the
// allocated stack area. To be safe in potential stack underflows we leave
// some buffer below.
registers_[sp] = reinterpret_cast<int64_t>(stack_) + stack_size_ - 64;
// The ra and pc are initialized to a known bad value that will cause an
// access violation if the simulator ever tries to execute it.
registers_[pc] = bad_ra;
registers_[ra] = bad_ra;
last_debugger_input_ = nullptr;
}
Simulator::~Simulator() {
GlobalMonitor::Get()->RemoveLinkedAddress(&global_monitor_thread_);
free(stack_);
}
// Get the active Simulator for the current thread.
Simulator* Simulator::current(Isolate* isolate) {
v8::internal::Isolate::PerIsolateThreadData* isolate_data =
isolate->FindOrAllocatePerThreadDataForThisThread();
DCHECK_NOT_NULL(isolate_data);
Simulator* sim = isolate_data->simulator();
if (sim == nullptr) {
// TODO(146): delete the simulator object when a thread/isolate goes away.
sim = new Simulator(isolate);
isolate_data->set_simulator(sim);
}
return sim;
}
// Sets the register in the architecture state. It will also deal with updating
// Simulator internal state for special registers such as PC.
void Simulator::set_register(int reg, int64_t value) {
DCHECK((reg >= 0) && (reg < kNumSimuRegisters));
if (reg == pc) {
pc_modified_ = true;
}
// Zero register always holds 0.
registers_[reg] = (reg == 0) ? 0 : value;
}
void Simulator::set_dw_register(int reg, const int* dbl) {
DCHECK((reg >= 0) && (reg < kNumSimuRegisters));
registers_[reg] = dbl[1];
registers_[reg] = registers_[reg] << 32;
registers_[reg] += dbl[0];
}
void Simulator::set_fpu_register(int fpureg, int64_t value) {
DCHECK((fpureg >= 0) && (fpureg < kNumFPURegisters));
FPUregisters_[fpureg * 2] = value;
}
void Simulator::set_fpu_register_word(int fpureg, int32_t value) {
// Set ONLY lower 32-bits, leaving upper bits untouched.
DCHECK((fpureg >= 0) && (fpureg < kNumFPURegisters));
int32_t* pword;
if (kArchEndian == kLittle) {
pword = reinterpret_cast<int32_t*>(&FPUregisters_[fpureg * 2]);
} else {
pword = reinterpret_cast<int32_t*>(&FPUregisters_[fpureg * 2]) + 1;
}
*pword = value;
}
void Simulator::set_fpu_register_hi_word(int fpureg, int32_t value) {
// Set ONLY upper 32-bits, leaving lower bits untouched.
DCHECK((fpureg >= 0) && (fpureg < kNumFPURegisters));
int32_t* phiword;
if (kArchEndian == kLittle) {
phiword = (reinterpret_cast<int32_t*>(&FPUregisters_[fpureg * 2])) + 1;
} else {
phiword = reinterpret_cast<int32_t*>(&FPUregisters_[fpureg * 2]);
}
*phiword = value;
}
void Simulator::set_fpu_register_float(int fpureg, float value) {
DCHECK((fpureg >= 0) && (fpureg < kNumFPURegisters));
*bit_cast<float*>(&FPUregisters_[fpureg * 2]) = value;
}
void Simulator::set_fpu_register_double(int fpureg, double value) {
DCHECK((fpureg >= 0) && (fpureg < kNumFPURegisters));
*bit_cast<double*>(&FPUregisters_[fpureg * 2]) = value;
}
// Get the register from the architecture state. This function does handle
// the special case of accessing the PC register.
int64_t Simulator::get_register(int reg) const {
DCHECK((reg >= 0) && (reg < kNumSimuRegisters));
if (reg == 0)
return 0;
else
return registers_[reg] + ((reg == pc) ? Instruction::kPCReadOffset : 0);
}
double Simulator::get_double_from_register_pair(int reg) {
// TODO(plind): bad ABI stuff, refactor or remove.
DCHECK((reg >= 0) && (reg < kNumSimuRegisters) && ((reg % 2) == 0));
double dm_val = 0.0;
// Read the bits from the unsigned integer register_[] array
// into the double precision floating point value and return it.
char buffer[sizeof(registers_[0])];
memcpy(buffer, ®isters_[reg], sizeof(registers_[0]));
memcpy(&dm_val, buffer, sizeof(registers_[0]));
return (dm_val);
}
int64_t Simulator::get_fpu_register(int fpureg) const {
DCHECK((fpureg >= 0) && (fpureg < kNumFPURegisters));
return FPUregisters_[fpureg * 2];
}
int32_t Simulator::get_fpu_register_word(int fpureg) const {
DCHECK((fpureg >= 0) && (fpureg < kNumFPURegisters));
return static_cast<int32_t>(FPUregisters_[fpureg * 2] & 0xFFFFFFFF);
}
int32_t Simulator::get_fpu_register_signed_word(int fpureg) const {
DCHECK((fpureg >= 0) && (fpureg < kNumFPURegisters));
return static_cast<int32_t>(FPUregisters_[fpureg * 2] & 0xFFFFFFFF);
}
int32_t Simulator::get_fpu_register_hi_word(int fpureg) const {
DCHECK((fpureg >= 0) && (fpureg < kNumFPURegisters));
return static_cast<int32_t>((FPUregisters_[fpureg * 2] >> 32) & 0xFFFFFFFF);
}
float Simulator::get_fpu_register_float(int fpureg) const {
DCHECK((fpureg >= 0) && (fpureg < kNumFPURegisters));
return *bit_cast<float*>(const_cast<int64_t*>(&FPUregisters_[fpureg * 2]));
}
double Simulator::get_fpu_register_double(int fpureg) const {
DCHECK((fpureg >= 0) && (fpureg < kNumFPURegisters));
return *bit_cast<double*>(&FPUregisters_[fpureg * 2]);
}
template <typename T>
void Simulator::get_msa_register(int wreg, T* value) {
DCHECK((wreg >= 0) && (wreg < kNumMSARegisters));
memcpy(value, FPUregisters_ + wreg * 2, kSimd128Size);
}
template <typename T>
void Simulator::set_msa_register(int wreg, const T* value) {
DCHECK((wreg >= 0) && (wreg < kNumMSARegisters));
memcpy(FPUregisters_ + wreg * 2, value, kSimd128Size);
}
// Runtime FP routines take up to two double arguments and zero
// or one integer arguments. All are constructed here,
// from a0-a3 or f12 and f13 (n64), or f14 (O32).
void Simulator::GetFpArgs(double* x, double* y, int32_t* z) {
if (!IsMipsSoftFloatABI) {
const int fparg2 = 13;
*x = get_fpu_register_double(12);
*y = get_fpu_register_double(fparg2);
*z = static_cast<int32_t>(get_register(a2));
} else {
// TODO(plind): bad ABI stuff, refactor or remove.
// We use a char buffer to get around the strict-aliasing rules which
// otherwise allow the compiler to optimize away the copy.
char buffer[sizeof(*x)];
int32_t* reg_buffer = reinterpret_cast<int32_t*>(buffer);
// Registers a0 and a1 -> x.
reg_buffer[0] = get_register(a0);
reg_buffer[1] = get_register(a1);
memcpy(x, buffer, sizeof(buffer));
// Registers a2 and a3 -> y.
reg_buffer[0] = get_register(a2);
reg_buffer[1] = get_register(a3);
memcpy(y, buffer, sizeof(buffer));
// Register 2 -> z.
reg_buffer[0] = get_register(a2);
memcpy(z, buffer, sizeof(*z));
}
}
// The return value is either in v0/v1 or f0.
void Simulator::SetFpResult(const double& result) {
if (!IsMipsSoftFloatABI) {
set_fpu_register_double(0, result);
} else {
char buffer[2 * sizeof(registers_[0])];
int64_t* reg_buffer = reinterpret_cast<int64_t*>(buffer);
memcpy(buffer, &result, sizeof(buffer));
// Copy result to v0 and v1.
set_register(v0, reg_buffer[0]);
set_register(v1, reg_buffer[1]);
}
}
// Helper functions for setting and testing the FCSR register's bits.
void Simulator::set_fcsr_bit(uint32_t cc, bool value) {
if (value) {
FCSR_ |= (1 << cc);
} else {
FCSR_ &= ~(1 << cc);
}
}
bool Simulator::test_fcsr_bit(uint32_t cc) { return FCSR_ & (1 << cc); }
void Simulator::set_fcsr_rounding_mode(FPURoundingMode mode) {
FCSR_ |= mode & kFPURoundingModeMask;
}
void Simulator::set_msacsr_rounding_mode(FPURoundingMode mode) {
MSACSR_ |= mode & kFPURoundingModeMask;
}
unsigned int Simulator::get_fcsr_rounding_mode() {
return FCSR_ & kFPURoundingModeMask;
}
unsigned int Simulator::get_msacsr_rounding_mode() {
return MSACSR_ & kFPURoundingModeMask;
}
// Sets the rounding error codes in FCSR based on the result of the rounding.
// Returns true if the operation was invalid.
bool Simulator::set_fcsr_round_error(double original, double rounded) {
bool ret = false;
double max_int32 = std::numeric_limits<int32_t>::max();
double min_int32 = std::numeric_limits<int32_t>::min();
if (!std::isfinite(original) || !std::isfinite(rounded)) {
set_fcsr_bit(kFCSRInvalidOpFlagBit, true);
ret = true;
}
if (original != rounded) {
set_fcsr_bit(kFCSRInexactFlagBit, true);
}
if (rounded < DBL_MIN && rounded > -DBL_MIN && rounded != 0) {
set_fcsr_bit(kFCSRUnderflowFlagBit, true);
ret = true;
}
if (rounded > max_int32 || rounded < min_int32) {
set_fcsr_bit(kFCSROverflowFlagBit, true);
// The reference is not really clear but it seems this is required:
set_fcsr_bit(kFCSRInvalidOpFlagBit, true);
ret = true;
}
return ret;
}
// Sets the rounding error codes in FCSR based on the result of the rounding.
// Returns true if the operation was invalid.
bool Simulator::set_fcsr_round64_error(double original, double rounded) {
bool ret = false;
// The value of INT64_MAX (2^63-1) can't be represented as double exactly,
// loading the most accurate representation into max_int64, which is 2^63.
double max_int64 = std::numeric_limits<int64_t>::max();
double min_int64 = std::numeric_limits<int64_t>::min();
if (!std::isfinite(original) || !std::isfinite(rounded)) {
set_fcsr_bit(kFCSRInvalidOpFlagBit, true);
ret = true;
}
if (original != rounded) {
set_fcsr_bit(kFCSRInexactFlagBit, true);
}
if (rounded < DBL_MIN && rounded > -DBL_MIN && rounded != 0) {
set_fcsr_bit(kFCSRUnderflowFlagBit, true);
ret = true;
}
if (rounded >= max_int64 || rounded < min_int64) {
set_fcsr_bit(kFCSROverflowFlagBit, true);
// The reference is not really clear but it seems this is required:
set_fcsr_bit(kFCSRInvalidOpFlagBit, true);
ret = true;
}
return ret;
}
// Sets the rounding error codes in FCSR based on the result of the rounding.
// Returns true if the operation was invalid.
bool Simulator::set_fcsr_round_error(float original, float rounded) {
bool ret = false;
double max_int32 = std::numeric_limits<int32_t>::max();
double min_int32 = std::numeric_limits<int32_t>::min();
if (!std::isfinite(original) || !std::isfinite(rounded)) {
set_fcsr_bit(kFCSRInvalidOpFlagBit, true);
ret = true;
}
if (original != rounded) {
set_fcsr_bit(kFCSRInexactFlagBit, true);
}
if (rounded < FLT_MIN && rounded > -FLT_MIN && rounded != 0) {
set_fcsr_bit(kFCSRUnderflowFlagBit, true);
ret = true;
}
if (rounded > max_int32 || rounded < min_int32) {
set_fcsr_bit(kFCSROverflowFlagBit, true);
// The reference is not really clear but it seems this is required:
set_fcsr_bit(kFCSRInvalidOpFlagBit, true);
ret = true;
}
return ret;
}
void Simulator::set_fpu_register_word_invalid_result(float original,
float rounded) {
if (FCSR_ & kFCSRNaN2008FlagMask) {
double max_int32 = std::numeric_limits<int32_t>::max();
double min_int32 = std::numeric_limits<int32_t>::min();
if (std::isnan(original)) {
set_fpu_register_word(fd_reg(), 0);
} else if (rounded > max_int32) {
set_fpu_register_word(fd_reg(), kFPUInvalidResult);
} else if (rounded < min_int32) {
set_fpu_register_word(fd_reg(), kFPUInvalidResultNegative);
} else {
UNREACHABLE();
}
} else {
set_fpu_register_word(fd_reg(), kFPUInvalidResult);
}
}
void Simulator::set_fpu_register_invalid_result(float original, float rounded) {
if (FCSR_ & kFCSRNaN2008FlagMask) {
double max_int32 = std::numeric_limits<int32_t>::max();
double min_int32 = std::numeric_limits<int32_t>::min();
if (std::isnan(original)) {
set_fpu_register(fd_reg(), 0);
} else if (rounded > max_int32) {
set_fpu_register(fd_reg(), kFPUInvalidResult);
} else if (rounded < min_int32) {
set_fpu_register(fd_reg(), kFPUInvalidResultNegative);
} else {
UNREACHABLE();
}
} else {
set_fpu_register(fd_reg(), kFPUInvalidResult);
}
}
void Simulator::set_fpu_register_invalid_result64(float original,
float rounded) {
if (FCSR_ & kFCSRNaN2008FlagMask) {
// The value of INT64_MAX (2^63-1) can't be represented as double exactly,
// loading the most accurate representation into max_int64, which is 2^63.
double max_int64 = std::numeric_limits<int64_t>::max();
double min_int64 = std::numeric_limits<int64_t>::min();
if (std::isnan(original)) {
set_fpu_register(fd_reg(), 0);
} else if (rounded >= max_int64) {
set_fpu_register(fd_reg(), kFPU64InvalidResult);
} else if (rounded < min_int64) {
set_fpu_register(fd_reg(), kFPU64InvalidResultNegative);
} else {
UNREACHABLE();
}
} else {
set_fpu_register(fd_reg(), kFPU64InvalidResult);
}
}
void Simulator::set_fpu_register_word_invalid_result(double original,
double rounded) {
if (FCSR_ & kFCSRNaN2008FlagMask) {
double max_int32 = std::numeric_limits<int32_t>::max();
double min_int32 = std::numeric_limits<int32_t>::min();
if (std::isnan(original)) {
set_fpu_register_word(fd_reg(), 0);
} else if (rounded > max_int32) {
set_fpu_register_word(fd_reg(), kFPUInvalidResult);
} else if (rounded < min_int32) {
set_fpu_register_word(fd_reg(), kFPUInvalidResultNegative);
} else {
UNREACHABLE();
}
} else {
set_fpu_register_word(fd_reg(), kFPUInvalidResult);
}
}
void Simulator::set_fpu_register_invalid_result(double original,
double rounded) {
if (FCSR_ & kFCSRNaN2008FlagMask) {
double max_int32 = std::numeric_limits<int32_t>::max();
double min_int32 = std::numeric_limits<int32_t>::min();
if (std::isnan(original)) {
set_fpu_register(fd_reg(), 0);
} else if (rounded > max_int32) {
set_fpu_register(fd_reg(), kFPUInvalidResult);
} else if (rounded < min_int32) {
set_fpu_register(fd_reg(), kFPUInvalidResultNegative);
} else {
UNREACHABLE();
}
} else {
set_fpu_register(fd_reg(), kFPUInvalidResult);
}
}
void Simulator::set_fpu_register_invalid_result64(double original,
double rounded) {
if (FCSR_ & kFCSRNaN2008FlagMask) {
// The value of INT64_MAX (2^63-1) can't be represented as double exactly,
// loading the most accurate representation into max_int64, which is 2^63.
double max_int64 = std::numeric_limits<int64_t>::max();
double min_int64 = std::numeric_limits<int64_t>::min();
if (std::isnan(original)) {
set_fpu_register(fd_reg(), 0);
} else if (rounded >= max_int64) {
set_fpu_register(fd_reg(), kFPU64InvalidResult);
} else if (rounded < min_int64) {
set_fpu_register(fd_reg(), kFPU64InvalidResultNegative);
} else {
UNREACHABLE();
}
} else {
set_fpu_register(fd_reg(), kFPU64InvalidResult);
}
}
// Sets the rounding error codes in FCSR based on the result of the rounding.
// Returns true if the operation was invalid.
bool Simulator::set_fcsr_round64_error(float original, float rounded) {
bool ret = false;
// The value of INT64_MAX (2^63-1) can't be represented as double exactly,
// loading the most accurate representation into max_int64, which is 2^63.
double max_int64 = std::numeric_limits<int64_t>::max();
double min_int64 = std::numeric_limits<int64_t>::min();
if (!std::isfinite(original) || !std::isfinite(rounded)) {
set_fcsr_bit(kFCSRInvalidOpFlagBit, true);
ret = true;
}
if (original != rounded) {
set_fcsr_bit(kFCSRInexactFlagBit, true);
}
if (rounded < FLT_MIN && rounded > -FLT_MIN && rounded != 0) {
set_fcsr_bit(kFCSRUnderflowFlagBit, true);
ret = true;
}
if (rounded >= max_int64 || rounded < min_int64) {
set_fcsr_bit(kFCSROverflowFlagBit, true);
// The reference is not really clear but it seems this is required:
set_fcsr_bit(kFCSRInvalidOpFlagBit, true);
ret = true;
}
return ret;
}
// For cvt instructions only
void Simulator::round_according_to_fcsr(double toRound, double* rounded,
int32_t* rounded_int, double fs) {
// 0 RN (round to nearest): Round a result to the nearest
// representable value; if the result is exactly halfway between
// two representable values, round to zero. Behave like round_w_d.
// 1 RZ (round toward zero): Round a result to the closest
// representable value whose absolute value is less than or
// equal to the infinitely accurate result. Behave like trunc_w_d.
// 2 RP (round up, or toward +infinity): Round a result to the
// next representable value up. Behave like ceil_w_d.
// 3 RN (round down, or toward infinity): Round a result to
// the next representable value down. Behave like floor_w_d.
switch (FCSR_ & 3) {
case kRoundToNearest:
*rounded = std::floor(fs + 0.5);
*rounded_int = static_cast<int32_t>(*rounded);
if ((*rounded_int & 1) != 0 && *rounded_int - fs == 0.5) {
// If the number is halfway between two integers,
// round to the even one.
*rounded_int -= 1;
*rounded -= 1.;
}
break;
case kRoundToZero:
*rounded = trunc(fs);
*rounded_int = static_cast<int32_t>(*rounded);
break;
case kRoundToPlusInf:
*rounded = std::ceil(fs);
*rounded_int = static_cast<int32_t>(*rounded);
break;
case kRoundToMinusInf:
*rounded = std::floor(fs);
*rounded_int = static_cast<int32_t>(*rounded);
break;
}
}
void Simulator::round64_according_to_fcsr(double toRound, double* rounded,
int64_t* rounded_int, double fs) {
// 0 RN (round to nearest): Round a result to the nearest
// representable value; if the result is exactly halfway between
// two representable values, round to zero. Behave like round_w_d.
// 1 RZ (round toward zero): Round a result to the closest
// representable value whose absolute value is less than or.
// equal to the infinitely accurate result. Behave like trunc_w_d.
// 2 RP (round up, or toward +infinity): Round a result to the
// next representable value up. Behave like ceil_w_d.
// 3 RN (round down, or toward infinity): Round a result to
// the next representable value down. Behave like floor_w_d.
switch (FCSR_ & 3) {
case kRoundToNearest:
*rounded = std::floor(fs + 0.5);
*rounded_int = static_cast<int64_t>(*rounded);
if ((*rounded_int & 1) != 0 && *rounded_int - fs == 0.5) {
// If the number is halfway between two integers,
// round to the even one.
*rounded_int -= 1;
*rounded -= 1.;
}
break;
case kRoundToZero:
*rounded = trunc(fs);
*rounded_int = static_cast<int64_t>(*rounded);
break;
case kRoundToPlusInf:
*rounded = std::ceil(fs);
*rounded_int = static_cast<int64_t>(*rounded);
break;
case kRoundToMinusInf:
*rounded = std::floor(fs);
*rounded_int = static_cast<int64_t>(*rounded);
break;
}
}
// for cvt instructions only
void Simulator::round_according_to_fcsr(float toRound, float* rounded,
int32_t* rounded_int, float fs) {
// 0 RN (round to nearest): Round a result to the nearest
// representable value; if the result is exactly halfway between
// two representable values, round to zero. Behave like round_w_d.
// 1 RZ (round toward zero): Round a result to the closest
// representable value whose absolute value is less than or
// equal to the infinitely accurate result. Behave like trunc_w_d.
// 2 RP (round up, or toward +infinity): Round a result to the
// next representable value up. Behave like ceil_w_d.
// 3 RN (round down, or toward infinity): Round a result to
// the next representable value down. Behave like floor_w_d.
switch (FCSR_ & 3) {
case kRoundToNearest:
*rounded = std::floor(fs + 0.5);
*rounded_int = static_cast<int32_t>(*rounded);
if ((*rounded_int & 1) != 0 && *rounded_int - fs == 0.5) {
// If the number is halfway between two integers,
// round to the even one.
*rounded_int -= 1;
*rounded -= 1.f;
}
break;
case kRoundToZero:
*rounded = trunc(fs);
*rounded_int = static_cast<int32_t>(*rounded);
break;
case kRoundToPlusInf:
*rounded = std::ceil(fs);
*rounded_int = static_cast<int32_t>(*rounded);
break;
case kRoundToMinusInf:
*rounded = std::floor(fs);
*rounded_int = static_cast<int32_t>(*rounded);
break;
}
}
void Simulator::round64_according_to_fcsr(float toRound, float* rounded,
int64_t* rounded_int, float fs) {
// 0 RN (round to nearest): Round a result to the nearest
// representable value; if the result is exactly halfway between
// two representable values, round to zero. Behave like round_w_d.
// 1 RZ (round toward zero): Round a result to the closest
// representable value whose absolute value is less than or.
// equal to the infinitely accurate result. Behave like trunc_w_d.
// 2 RP (round up, or toward +infinity): Round a result to the
// next representable value up. Behave like ceil_w_d.
// 3 RN (round down, or toward infinity): Round a result to
// the next representable value down. Behave like floor_w_d.
switch (FCSR_ & 3) {
case kRoundToNearest:
*rounded = std::floor(fs + 0.5);
*rounded_int = static_cast<int64_t>(*rounded);
if ((*rounded_int & 1) != 0 && *rounded_int - fs == 0.5) {
// If the number is halfway between two integers,
// round to the even one.
*rounded_int -= 1;
*rounded -= 1.f;
}
break;
case kRoundToZero:
*rounded = trunc(fs);
*rounded_int = static_cast<int64_t>(*rounded);
break;
case kRoundToPlusInf:
*rounded = std::ceil(fs);
*rounded_int = static_cast<int64_t>(*rounded);
break;
case kRoundToMinusInf:
*rounded = std::floor(fs);
*rounded_int = static_cast<int64_t>(*rounded);
break;
}
}
template <typename T_fp, typename T_int>
void Simulator::round_according_to_msacsr(T_fp toRound, T_fp* rounded,
T_int* rounded_int) {
// 0 RN (round to nearest): Round a result to the nearest
// representable value; if the result is exactly halfway between
// two representable values, round to zero. Behave like round_w_d.
// 1 RZ (round toward zero): Round a result to the closest
// representable value whose absolute value is less than or
// equal to the infinitely accurate result. Behave like trunc_w_d.
// 2 RP (round up, or toward +infinity): Round a result to the
// next representable value up. Behave like ceil_w_d.
// 3 RN (round down, or toward infinity): Round a result to
// the next representable value down. Behave like floor_w_d.
switch (get_msacsr_rounding_mode()) {
case kRoundToNearest:
*rounded = std::floor(toRound + 0.5);
*rounded_int = static_cast<T_int>(*rounded);
if ((*rounded_int & 1) != 0 && *rounded_int - toRound == 0.5) {
// If the number is halfway between two integers,
// round to the even one.
*rounded_int -= 1;
*rounded -= 1.;
}
break;
case kRoundToZero:
*rounded = trunc(toRound);
*rounded_int = static_cast<T_int>(*rounded);
break;
case kRoundToPlusInf:
*rounded = std::ceil(toRound);
*rounded_int = static_cast<T_int>(*rounded);
break;
case kRoundToMinusInf:
*rounded = std::floor(toRound);
*rounded_int = static_cast<T_int>(*rounded);
break;
}
}
// Raw access to the PC register.
void Simulator::set_pc(int64_t value) {
pc_modified_ = true;
registers_[pc] = value;
}
bool Simulator::has_bad_pc() const {
return ((registers_[pc] == bad_ra) || (registers_[pc] == end_sim_pc));
}
// Raw access to the PC register without the special adjustment when reading.
int64_t Simulator::get_pc() const { return registers_[pc]; }
// The MIPS cannot do unaligned reads and writes. On some MIPS platforms an
// interrupt is caused. On others it does a funky rotation thing. For now we
// simply disallow unaligned reads, but at some point we may want to move to
// emulating the rotate behaviour. Note that simulator runs have the runtime
// system running directly on the host system and only generated code is
// executed in the simulator. Since the host is typically IA32 we will not
// get the correct MIPS-like behaviour on unaligned accesses.
// TODO(plind): refactor this messy debug code when we do unaligned access.
void Simulator::DieOrDebug() {
if ((1)) { // Flag for this was removed.
MipsDebugger dbg(this);
dbg.Debug();
} else {
base::OS::Abort();
}
}
void Simulator::TraceRegWr(int64_t value, TraceType t) {
if (::v8::internal::FLAG_trace_sim) {
union {
int64_t fmt_int64;
int32_t fmt_int32[2];
float fmt_float[2];
double fmt_double;
} v;
v.fmt_int64 = value;
switch (t) {
case WORD:
SNPrintF(trace_buf_,
"%016" PRIx64 " (%" PRId64 ") int32:%" PRId32
" uint32:%" PRIu32,
v.fmt_int64, icount_, v.fmt_int32[0], v.fmt_int32[0]);
break;
case DWORD:
SNPrintF(trace_buf_,
"%016" PRIx64 " (%" PRId64 ") int64:%" PRId64
" uint64:%" PRIu64,
value, icount_, value, value);
break;
case FLOAT:
SNPrintF(trace_buf_, "%016" PRIx64 " (%" PRId64 ") flt:%e",
v.fmt_int64, icount_, v.fmt_float[0]);
break;
case DOUBLE:
SNPrintF(trace_buf_, "%016" PRIx64 " (%" PRId64 ") dbl:%e",
v.fmt_int64, icount_, v.fmt_double);
break;
case FLOAT_DOUBLE:
SNPrintF(trace_buf_, "%016" PRIx64 " (%" PRId64 ") flt:%e dbl:%e",
v.fmt_int64, icount_, v.fmt_float[0], v.fmt_double);
break;
case WORD_DWORD:
SNPrintF(trace_buf_,
"%016" PRIx64 " (%" PRId64 ") int32:%" PRId32
" uint32:%" PRIu32 " int64:%" PRId64 " uint64:%" PRIu64,
v.fmt_int64, icount_, v.fmt_int32[0], v.fmt_int32[0],
v.fmt_int64, v.fmt_int64);
break;
default:
UNREACHABLE();
}
}
}
template <typename T>
void Simulator::TraceMSARegWr(T* value, TraceType t) {
if (::v8::internal::FLAG_trace_sim) {
union {
uint8_t b[16];
uint16_t h[8];
uint32_t w[4];
uint64_t d[2];
float f[4];
double df[2];
} v;
memcpy(v.b, value, kSimd128Size);
switch (t) {
case BYTE:
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 ")",
v.d[0], v.d[1], icount_);
break;
case HALF:
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 ")",
v.d[0], v.d[1], icount_);
break;
case WORD:
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") int32[0..3]:%" PRId32 " %" PRId32 " %" PRId32
" %" PRId32,
v.d[0], v.d[1], icount_, v.w[0], v.w[1], v.w[2], v.w[3]);
break;
case DWORD:
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 ")",
v.d[0], v.d[1], icount_);
break;
case FLOAT:
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") flt[0..3]:%e %e %e %e",
v.d[0], v.d[1], icount_, v.f[0], v.f[1], v.f[2], v.f[3]);
break;
case DOUBLE:
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") dbl[0..1]:%e %e",
v.d[0], v.d[1], icount_, v.df[0], v.df[1]);
break;
default:
UNREACHABLE();
}
}
}
template <typename T>
void Simulator::TraceMSARegWr(T* value) {
if (::v8::internal::FLAG_trace_sim) {
union {
uint8_t b[kMSALanesByte];
uint16_t h[kMSALanesHalf];
uint32_t w[kMSALanesWord];
uint64_t d[kMSALanesDword];
float f[kMSALanesWord];
double df[kMSALanesDword];
} v;
memcpy(v.b, value, kMSALanesByte);
if (std::is_same<T, int32_t>::value) {
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") int32[0..3]:%" PRId32 " %" PRId32 " %" PRId32
" %" PRId32,
v.d[0], v.d[1], icount_, v.w[0], v.w[1], v.w[2], v.w[3]);
} else if (std::is_same<T, float>::value) {
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") flt[0..3]:%e %e %e %e",
v.d[0], v.d[1], icount_, v.f[0], v.f[1], v.f[2], v.f[3]);
} else if (std::is_same<T, double>::value) {
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") dbl[0..1]:%e %e",
v.d[0], v.d[1], icount_, v.df[0], v.df[1]);
} else {
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 ")",
v.d[0], v.d[1], icount_);
}
}
}
// TODO(plind): consider making icount_ printing a flag option.
void Simulator::TraceMemRd(int64_t addr, int64_t value, TraceType t) {
if (::v8::internal::FLAG_trace_sim) {
union {
int64_t fmt_int64;
int32_t fmt_int32[2];
float fmt_float[2];
double fmt_double;
} v;
v.fmt_int64 = value;
switch (t) {
case WORD:
SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") int32:%" PRId32 " uint32:%" PRIu32,
v.fmt_int64, addr, icount_, v.fmt_int32[0], v.fmt_int32[0]);
break;
case DWORD:
SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") int64:%" PRId64 " uint64:%" PRIu64,
value, addr, icount_, value, value);
break;
case FLOAT:
SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") flt:%e",
v.fmt_int64, addr, icount_, v.fmt_float[0]);
break;
case DOUBLE:
SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") dbl:%e",
v.fmt_int64, addr, icount_, v.fmt_double);
break;
case FLOAT_DOUBLE:
SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") flt:%e dbl:%e",
v.fmt_int64, addr, icount_, v.fmt_float[0], v.fmt_double);
break;
default:
UNREACHABLE();
}
}
}
void Simulator::TraceMemWr(int64_t addr, int64_t value, TraceType t) {
if (::v8::internal::FLAG_trace_sim) {
switch (t) {
case BYTE:
SNPrintF(trace_buf_,
" %02" PRIx8 " --> [%016" PRIx64 "] (%" PRId64
")",
static_cast<uint8_t>(value), addr, icount_);
break;
case HALF:
SNPrintF(trace_buf_,
" %04" PRIx16 " --> [%016" PRIx64 "] (%" PRId64
")",
static_cast<uint16_t>(value), addr, icount_);
break;
case WORD:
SNPrintF(trace_buf_,
" %08" PRIx32 " --> [%016" PRIx64 "] (%" PRId64 ")",
static_cast<uint32_t>(value), addr, icount_);
break;
case DWORD:
SNPrintF(trace_buf_,
"%016" PRIx64 " --> [%016" PRIx64 "] (%" PRId64 " )",
value, addr, icount_);
break;
default:
UNREACHABLE();
}
}
}
template <typename T>
void Simulator::TraceMemRd(int64_t addr, T value) {
if (::v8::internal::FLAG_trace_sim) {
switch (sizeof(T)) {
case 1:
SNPrintF(trace_buf_,
"%08" PRIx8 " <-- [%08" PRIx64 "] (%" PRIu64
") int8:%" PRId8 " uint8:%" PRIu8,
static_cast<uint8_t>(value), addr, icount_,
static_cast<int8_t>(value), static_cast<uint8_t>(value));
break;
case 2:
SNPrintF(trace_buf_,
"%08" PRIx16 " <-- [%08" PRIx64 "] (%" PRIu64
") int16:%" PRId16 " uint16:%" PRIu16,
static_cast<uint16_t>(value), addr, icount_,
static_cast<int16_t>(value), static_cast<uint16_t>(value));
break;
case 4:
SNPrintF(trace_buf_,
"%08" PRIx32 " <-- [%08" PRIx64 "] (%" PRIu64
") int32:%" PRId32 " uint32:%" PRIu32,
static_cast<uint32_t>(value), addr, icount_,
static_cast<int32_t>(value), static_cast<uint32_t>(value));
break;
case 8:
SNPrintF(trace_buf_,
"%08" PRIx64 " <-- [%08" PRIx64 "] (%" PRIu64
") int64:%" PRId64 " uint64:%" PRIu64,
static_cast<uint64_t>(value), addr, icount_,
static_cast<int64_t>(value), static_cast<uint64_t>(value));
break;
default:
UNREACHABLE();
}
}
}
template <typename T>
void Simulator::TraceMemWr(int64_t addr, T value) {
if (::v8::internal::FLAG_trace_sim) {
switch (sizeof(T)) {
case 1:
SNPrintF(trace_buf_,
" %02" PRIx8 " --> [%08" PRIx64 "] (%" PRIu64 ")",
static_cast<uint8_t>(value), addr, icount_);
break;
case 2:
SNPrintF(trace_buf_,
" %04" PRIx16 " --> [%08" PRIx64 "] (%" PRIu64 ")",
static_cast<uint16_t>(value), addr, icount_);
break;
case 4:
SNPrintF(trace_buf_,
"%08" PRIx32 " --> [%08" PRIx64 "] (%" PRIu64 ")",
static_cast<uint32_t>(value), addr, icount_);
break;
case 8:
SNPrintF(trace_buf_,
"%16" PRIx64 " --> [%08" PRIx64 "] (%" PRIu64 ")",
static_cast<uint64_t>(value), addr, icount_);
break;
default:
UNREACHABLE();
}
}
}
// TODO(plind): sign-extend and zero-extend not implmented properly
// on all the ReadXX functions, I don't think re-interpret cast does it.
int32_t Simulator::ReadW(int64_t addr, Instruction* instr, TraceType t) {
if (addr >= 0 && addr < 0x400) {
// This has to be a nullptr-dereference, drop into debugger.
PrintF("Memory read from bad address: 0x%08" PRIx64 " , pc=0x%08" PRIxPTR
" \n",
addr, reinterpret_cast<intptr_t>(instr));
DieOrDebug();
}
if ((addr & 0x3) == 0 || kArchVariant == kMips64r6) {
local_monitor_.NotifyLoad();
int32_t* ptr = reinterpret_cast<int32_t*>(addr);
TraceMemRd(addr, static_cast<int64_t>(*ptr), t);
return *ptr;
}
PrintF("Unaligned read at 0x%08" PRIx64 " , pc=0x%08" V8PRIxPTR "\n", addr,
reinterpret_cast<intptr_t>(instr));
DieOrDebug();
return 0;
}
uint32_t Simulator::ReadWU(int64_t addr, Instruction* instr) {
if (addr >= 0 && addr < 0x400) {
// This has to be a nullptr-dereference, drop into debugger.
PrintF("Memory read from bad address: 0x%08" PRIx64 " , pc=0x%08" PRIxPTR
" \n",
addr, reinterpret_cast<intptr_t>(instr));
DieOrDebug();
}
if ((addr & 0x3) == 0 || kArchVariant == kMips64r6) {
local_monitor_.NotifyLoad();
uint32_t* ptr = reinterpret_cast<uint32_t*>(addr);
TraceMemRd(addr, static_cast<int64_t>(*ptr), WORD);
return *ptr;
}
PrintF("Unaligned read at 0x%08" PRIx64 " , pc=0x%08" V8PRIxPTR "\n", addr,
reinterpret_cast<intptr_t>(instr));
DieOrDebug();
return 0;
}
void Simulator::WriteW(int64_t addr, int32_t value, Instruction* instr) {
if (addr >= 0 && addr < 0x400) {
// This has to be a nullptr-dereference, drop into debugger.
PrintF("Memory write to bad address: 0x%08" PRIx64 " , pc=0x%08" PRIxPTR
" \n",
addr, reinterpret_cast<intptr_t>(instr));
DieOrDebug();
}
if ((addr & 0x3) == 0 || kArchVariant == kMips64r6) {
local_monitor_.NotifyStore();
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
GlobalMonitor::Get()->NotifyStore_Locked(&global_monitor_thread_);
TraceMemWr(addr, value, WORD);
int* ptr = reinterpret_cast<int*>(addr);
*ptr = value;
return;
}
PrintF("Unaligned write at 0x%08" PRIx64 " , pc=0x%08" V8PRIxPTR "\n", addr,
reinterpret_cast<intptr_t>(instr));
DieOrDebug();
}
void Simulator::WriteConditionalW(int64_t addr, int32_t value,
Instruction* instr, int32_t rt_reg) {
if (addr >= 0 && addr < 0x400) {
// This has to be a nullptr-dereference, drop into debugger.
PrintF("Memory write to bad address: 0x%08" PRIx64 " , pc=0x%08" PRIxPTR
" \n",
addr, reinterpret_cast<intptr_t>(instr));
DieOrDebug();
}
if ((addr & 0x3) == 0 || kArchVariant == kMips64r6) {
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
if (local_monitor_.NotifyStoreConditional(addr, TransactionSize::Word) &&
GlobalMonitor::Get()->NotifyStoreConditional_Locked(
addr, &global_monitor_thread_)) {
local_monitor_.NotifyStore();
GlobalMonitor::Get()->NotifyStore_Locked(&global_monitor_thread_);
TraceMemWr(addr, value, WORD);
int* ptr = reinterpret_cast<int*>(addr);
*ptr = value;
set_register(rt_reg, 1);
} else {
set_register(rt_reg, 0);
}
return;
}
PrintF("Unaligned write at 0x%08" PRIx64 " , pc=0x%08" V8PRIxPTR "\n", addr,
reinterpret_cast<intptr_t>(instr));
DieOrDebug();
}
int64_t Simulator::Read2W(int64_t addr, Instruction* instr) {
if (addr >= 0 && addr < 0x400) {
// This has to be a nullptr-dereference, drop into debugger.
PrintF("Memory read from bad address: 0x%08" PRIx64 " , pc=0x%08" PRIxPTR
" \n",
addr, reinterpret_cast<intptr_t>(instr));
DieOrDebug();
}
if ((addr & kPointerAlignmentMask) == 0 || kArchVariant == kMips64r6) {
local_monitor_.NotifyLoad();
int64_t* ptr = reinterpret_cast<int64_t*>(addr);
TraceMemRd(addr, *ptr);
return *ptr;
}
PrintF("Unaligned read at 0x%08" PRIx64 " , pc=0x%08" V8PRIxPTR "\n", addr,
reinterpret_cast<intptr_t>(instr));
DieOrDebug();
return 0;
}
void Simulator::Write2W(int64_t addr, int64_t value, Instruction* instr) {
if (addr >= 0 && addr < 0x400) {
// This has to be a nullptr-dereference, drop into debugger.
PrintF("Memory write to bad address: 0x%08" PRIx64 " , pc=0x%08" PRIxPTR
"\n",
addr, reinterpret_cast<intptr_t>(instr));
DieOrDebug();
}
if ((addr & kPointerAlignmentMask) == 0 || kArchVariant == kMips64r6) {
local_monitor_.NotifyStore();
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
GlobalMonitor::Get()->NotifyStore_Locked(&global_monitor_thread_);
TraceMemWr(addr, value, DWORD);
int64_t* ptr = reinterpret_cast<int64_t*>(addr);
*ptr = value;
return;
}
PrintF("Unaligned write at 0x%08" PRIx64 " , pc=0x%08" V8PRIxPTR "\n", addr,
reinterpret_cast<intptr_t>(instr));
DieOrDebug();
}
void Simulator::WriteConditional2W(int64_t addr, int64_t value,
Instruction* instr, int32_t rt_reg) {
if (addr >= 0 && addr < 0x400) {
// This has to be a nullptr-dereference, drop into debugger.
PrintF("Memory write to bad address: 0x%08" PRIx64 " , pc=0x%08" PRIxPTR
"\n",
addr, reinterpret_cast<intptr_t>(instr));
DieOrDebug();
}
if ((addr & kPointerAlignmentMask) == 0 || kArchVariant == kMips64r6) {
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
if (local_monitor_.NotifyStoreConditional(addr,
TransactionSize::DoubleWord) &&
GlobalMonitor::Get()->NotifyStoreConditional_Locked(
addr, &global_monitor_thread_)) {
local_monitor_.NotifyStore();
GlobalMonitor::Get()->NotifyStore_Locked(&global_monitor_thread_);
TraceMemWr(addr, value, DWORD);
int64_t* ptr = reinterpret_cast<int64_t*>(addr);
*ptr = value;
set_register(rt_reg, 1);
} else {
set_register(rt_reg, 0);
}
return;
}
PrintF("Unaligned write at 0x%08" PRIx64 " , pc=0x%08" V8PRIxPTR "\n", addr,
reinterpret_cast<intptr_t>(instr));
DieOrDebug();
}
double Simulator::ReadD(int64_t addr, Instruction* instr) {
if ((addr & kDoubleAlignmentMask) == 0 || kArchVariant == kMips64r6) {
local_monitor_.NotifyLoad();
double* ptr = reinterpret_cast<double*>(addr);
return *ptr;
}
PrintF("Unaligned (double) read at 0x%08" PRIx64 " , pc=0x%08" V8PRIxPTR "\n",
addr, reinterpret_cast<intptr_t>(instr));
base::OS::Abort();
return 0;
}
void Simulator::WriteD(int64_t addr, double value, Instruction* instr) {
if ((addr & kDoubleAlignmentMask) == 0 || kArchVariant == kMips64r6) {
local_monitor_.NotifyStore();
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
GlobalMonitor::Get()->NotifyStore_Locked(&global_monitor_thread_);
double* ptr = reinterpret_cast<double*>(addr);
*ptr = value;
return;
}
PrintF("Unaligned (double) write at 0x%08" PRIx64 " , pc=0x%08" V8PRIxPTR
"\n",
addr, reinterpret_cast<intptr_t>(instr));
DieOrDebug();
}
uint16_t Simulator::ReadHU(int64_t addr, Instruction* instr) {
if ((addr & 1) == 0 || kArchVariant == kMips64r6) {
local_monitor_.NotifyLoad();
uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
TraceMemRd(addr, static_cast<int64_t>(*ptr));
return *ptr;
}
PrintF("Unaligned unsigned halfword read at 0x%08" PRIx64
" , pc=0x%08" V8PRIxPTR "\n",
addr, reinterpret_cast<intptr_t>(instr));
DieOrDebug();
return 0;
}
int16_t Simulator::ReadH(int64_t addr, Instruction* instr) {
if ((addr & 1) == 0 || kArchVariant == kMips64r6) {
local_monitor_.NotifyLoad();
int16_t* ptr = reinterpret_cast<int16_t*>(addr);
TraceMemRd(addr, static_cast<int64_t>(*ptr));
return *ptr;
}
PrintF("Unaligned signed halfword read at 0x%08" PRIx64
" , pc=0x%08" V8PRIxPTR "\n",
addr, reinterpret_cast<intptr_t>(instr));
DieOrDebug();
return 0;
}
void Simulator::WriteH(int64_t addr, uint16_t value, Instruction* instr) {
if ((addr & 1) == 0 || kArchVariant == kMips64r6) {
local_monitor_.NotifyStore();
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
GlobalMonitor::Get()->NotifyStore_Locked(&global_monitor_thread_);
TraceMemWr(addr, value, HALF);
uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
*ptr = value;
return;
}
PrintF("Unaligned unsigned halfword write at 0x%08" PRIx64
" , pc=0x%08" V8PRIxPTR "\n",
addr, reinterpret_cast<intptr_t>(instr));
DieOrDebug();
}
void Simulator::WriteH(int64_t addr, int16_t value, Instruction* instr) {
if ((addr & 1) == 0 || kArchVariant == kMips64r6) {
local_monitor_.NotifyStore();
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
GlobalMonitor::Get()->NotifyStore_Locked(&global_monitor_thread_);
TraceMemWr(addr, value, HALF);
int16_t* ptr = reinterpret_cast<int16_t*>(addr);
*ptr = value;
return;
}
PrintF("Unaligned halfword write at 0x%08" PRIx64 " , pc=0x%08" V8PRIxPTR
"\n",
addr, reinterpret_cast<intptr_t>(instr));
DieOrDebug();
}
uint32_t Simulator::ReadBU(int64_t addr) {
local_monitor_.NotifyLoad();
uint8_t* ptr = reinterpret_cast<uint8_t*>(addr);
TraceMemRd(addr, static_cast<int64_t>(*ptr));
return *ptr & 0xFF;
}
int32_t Simulator::ReadB(int64_t addr) {
local_monitor_.NotifyLoad();
int8_t* ptr = reinterpret_cast<int8_t*>(addr);
TraceMemRd(addr, static_cast<int64_t>(*ptr));
return *ptr;
}
void Simulator::WriteB(int64_t addr, uint8_t value) {
local_monitor_.NotifyStore();
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
GlobalMonitor::Get()->NotifyStore_Locked(&global_monitor_thread_);
TraceMemWr(addr, value, BYTE);
uint8_t* ptr = reinterpret_cast<uint8_t*>(addr);
*ptr = value;
}
void Simulator::WriteB(int64_t addr, int8_t value) {
local_monitor_.NotifyStore();
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
GlobalMonitor::Get()->NotifyStore_Locked(&global_monitor_thread_);
TraceMemWr(addr, value, BYTE);
int8_t* ptr = reinterpret_cast<int8_t*>(addr);
*ptr = value;
}
template <typename T>
T Simulator::ReadMem(int64_t addr, Instruction* instr) {
int alignment_mask = (1 << sizeof(T)) - 1;
if ((addr & alignment_mask) == 0 || kArchVariant == kMips64r6) {
local_monitor_.NotifyLoad();
T* ptr = reinterpret_cast<T*>(addr);
TraceMemRd(addr, *ptr);
return *ptr;
}
PrintF("Unaligned read of type sizeof(%ld) at 0x%08lx, pc=0x%08" V8PRIxPTR
"\n",
sizeof(T), addr, reinterpret_cast<intptr_t>(instr));
base::OS::Abort();
return 0;
}
template <typename T>
void Simulator::WriteMem(int64_t addr, T value, Instruction* instr) {
int alignment_mask = (1 << sizeof(T)) - 1;
if ((addr & alignment_mask) == 0 || kArchVariant == kMips64r6) {
local_monitor_.NotifyStore();
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
GlobalMonitor::Get()->NotifyStore_Locked(&global_monitor_thread_);
T* ptr = reinterpret_cast<T*>(addr);
*ptr = value;
TraceMemWr(addr, value);
return;
}
PrintF("Unaligned write of type sizeof(%ld) at 0x%08lx, pc=0x%08" V8PRIxPTR
"\n",
sizeof(T), addr, reinterpret_cast<intptr_t>(instr));
base::OS::Abort();
}
// Returns the limit of the stack area to enable checking for stack overflows.
uintptr_t Simulator::StackLimit(uintptr_t c_limit) const {
// The simulator uses a separate JS stack. If we have exhausted the C stack,
// we also drop down the JS limit to reflect the exhaustion on the JS stack.
if (GetCurrentStackPosition() < c_limit) {
return reinterpret_cast<uintptr_t>(get_sp());
}
// Otherwise the limit is the JS stack. Leave a safety margin of 1024 bytes
// to prevent overrunning the stack when pushing values.
return reinterpret_cast<uintptr_t>(stack_) + 1024;
}
// Unsupported instructions use Format to print an error and stop execution.
void Simulator::Format(Instruction* instr, const char* format) {
PrintF("Simulator found unsupported instruction:\n 0x%08" PRIxPTR " : %s\n",
reinterpret_cast<intptr_t>(instr), format);
UNIMPLEMENTED_MIPS();
}
// Calls into the V8 runtime are based on this very simple interface.
// Note: To be able to return two values from some calls the code in runtime.cc
// uses the ObjectPair which is essentially two 32-bit values stuffed into a
// 64-bit value. With the code below we assume that all runtime calls return
// 64 bits of result. If they don't, the v1 result register contains a bogus
// value, which is fine because it is caller-saved.
using SimulatorRuntimeCall = ObjectPair (*)(int64_t arg0, int64_t arg1,
int64_t arg2, int64_t arg3,
int64_t arg4, int64_t arg5,
int64_t arg6, int64_t arg7,
int64_t arg8, int64_t arg9);
// These prototypes handle the four types of FP calls.
using SimulatorRuntimeCompareCall = int64_t (*)(double darg0, double darg1);
using SimulatorRuntimeFPFPCall = double (*)(double darg0, double darg1);
using SimulatorRuntimeFPCall = double (*)(double darg0);
using SimulatorRuntimeFPIntCall = double (*)(double darg0, int32_t arg0);
// This signature supports direct call in to API function native callback
// (refer to InvocationCallback in v8.h).
using SimulatorRuntimeDirectApiCall = void (*)(int64_t arg0);
using SimulatorRuntimeProfilingApiCall = void (*)(int64_t arg0, void* arg1);
// This signature supports direct call to accessor getter callback.
using SimulatorRuntimeDirectGetterCall = void (*)(int64_t arg0, int64_t arg1);
using SimulatorRuntimeProfilingGetterCall = void (*)(int64_t arg0, int64_t arg1,
void* arg2);
// Software interrupt instructions are used by the simulator to call into the
// C-based V8 runtime. They are also used for debugging with simulator.
void Simulator::SoftwareInterrupt() {
// There are several instructions that could get us here,
// the break_ instruction, or several variants of traps. All
// Are "SPECIAL" class opcode, and are distinuished by function.
int32_t func = instr_.FunctionFieldRaw();
uint32_t code = (func == BREAK) ? instr_.Bits(25, 6) : -1;
// We first check if we met a call_rt_redirected.
if (instr_.InstructionBits() == rtCallRedirInstr) {
Redirection* redirection = Redirection::FromInstruction(instr_.instr());
int64_t* stack_pointer = reinterpret_cast<int64_t*>(get_register(sp));
int64_t arg0 = get_register(a0);
int64_t arg1 = get_register(a1);
int64_t arg2 = get_register(a2);
int64_t arg3 = get_register(a3);
int64_t arg4 = get_register(a4);
int64_t arg5 = get_register(a5);
int64_t arg6 = get_register(a6);
int64_t arg7 = get_register(a7);
int64_t arg8 = stack_pointer[0];
int64_t arg9 = stack_pointer[1];
STATIC_ASSERT(kMaxCParameters == 10);
bool fp_call =
(redirection->type() == ExternalReference::BUILTIN_FP_FP_CALL) ||
(redirection->type() == ExternalReference::BUILTIN_COMPARE_CALL) ||
(redirection->type() == ExternalReference::BUILTIN_FP_CALL) ||
(redirection->type() == ExternalReference::BUILTIN_FP_INT_CALL);
if (!IsMipsSoftFloatABI) {
// With the hard floating point calling convention, double
// arguments are passed in FPU registers. Fetch the arguments
// from there and call the builtin using soft floating point
// convention.
switch (redirection->type()) {
case ExternalReference::BUILTIN_FP_FP_CALL:
case ExternalReference::BUILTIN_COMPARE_CALL:
arg0 = get_fpu_register(f12);
arg1 = get_fpu_register(f13);
arg2 = get_fpu_register(f14);
arg3 = get_fpu_register(f15);
break;
case ExternalReference::BUILTIN_FP_CALL:
arg0 = get_fpu_register(f12);
arg1 = get_fpu_register(f13);
break;
case ExternalReference::BUILTIN_FP_INT_CALL:
arg0 = get_fpu_register(f12);
arg1 = get_fpu_register(f13);
arg2 = get_register(a2);
break;
default:
break;
}
}
// This is dodgy but it works because the C entry stubs are never moved.
// See comment in codegen-arm.cc and bug 1242173.
int64_t saved_ra = get_register(ra);
intptr_t external =
reinterpret_cast<intptr_t>(redirection->external_function());
// Based on CpuFeatures::IsSupported(FPU), Mips will use either hardware
// FPU, or gcc soft-float routines. Hardware FPU is simulated in this
// simulator. Soft-float has additional abstraction of ExternalReference,
// to support serialization.
if (fp_call) {
double dval0, dval1; // one or two double parameters
int32_t ival; // zero or one integer parameters
int64_t iresult = 0; // integer return value
double dresult = 0; // double return value
GetFpArgs(&dval0, &dval1, &ival);
SimulatorRuntimeCall generic_target =
reinterpret_cast<SimulatorRuntimeCall>(external);
if (::v8::internal::FLAG_trace_sim) {
switch (redirection->type()) {
case ExternalReference::BUILTIN_FP_FP_CALL:
case ExternalReference::BUILTIN_COMPARE_CALL:
PrintF("Call to host function at %p with args %f, %f",
reinterpret_cast<void*>(FUNCTION_ADDR(generic_target)),
dval0, dval1);
break;
case ExternalReference::BUILTIN_FP_CALL:
PrintF("Call to host function at %p with arg %f",
reinterpret_cast<void*>(FUNCTION_ADDR(generic_target)),
dval0);
break;
case ExternalReference::BUILTIN_FP_INT_CALL:
PrintF("Call to host function at %p with args %f, %d",
reinterpret_cast<void*>(FUNCTION_ADDR(generic_target)),
dval0, ival);
break;
default:
UNREACHABLE();
break;
}
}
switch (redirection->type()) {
case ExternalReference::BUILTIN_COMPARE_CALL: {
SimulatorRuntimeCompareCall target =
reinterpret_cast<SimulatorRuntimeCompareCall>(external);
iresult = target(dval0, dval1);
set_register(v0, static_cast<int64_t>(iresult));
// set_register(v1, static_cast<int64_t>(iresult >> 32));
break;
}
case ExternalReference::BUILTIN_FP_FP_CALL: {
SimulatorRuntimeFPFPCall target =
reinterpret_cast<SimulatorRuntimeFPFPCall>(external);
dresult = target(dval0, dval1);
SetFpResult(dresult);
break;
}
case ExternalReference::BUILTIN_FP_CALL: {
SimulatorRuntimeFPCall target =
reinterpret_cast<SimulatorRuntimeFPCall>(external);
dresult = target(dval0);
SetFpResult(dresult);
break;
}
case ExternalReference::BUILTIN_FP_INT_CALL: {
SimulatorRuntimeFPIntCall target =
reinterpret_cast<SimulatorRuntimeFPIntCall>(external);
dresult = target(dval0, ival);
SetFpResult(dresult);
break;
}
default:
UNREACHABLE();
break;
}
if (::v8::internal::FLAG_trace_sim) {
switch (redirection->type()) {
case ExternalReference::BUILTIN_COMPARE_CALL:
PrintF("Returned %08x\n", static_cast<int32_t>(iresult));
break;
case ExternalReference::BUILTIN_FP_FP_CALL:
case ExternalReference::BUILTIN_FP_CALL:
case ExternalReference::BUILTIN_FP_INT_CALL:
PrintF("Returned %f\n", dresult);
break;
default:
UNREACHABLE();
break;
}
}
} else if (redirection->type() == ExternalReference::DIRECT_API_CALL) {
if (::v8::internal::FLAG_trace_sim) {
PrintF("Call to host function at %p args %08" PRIx64 " \n",
reinterpret_cast<void*>(external), arg0);
}
SimulatorRuntimeDirectApiCall target =
reinterpret_cast<SimulatorRuntimeDirectApiCall>(external);
target(arg0);
} else if (redirection->type() == ExternalReference::PROFILING_API_CALL) {
if (::v8::internal::FLAG_trace_sim) {
PrintF("Call to host function at %p args %08" PRIx64 " %08" PRIx64
" \n",
reinterpret_cast<void*>(external), arg0, arg1);
}
SimulatorRuntimeProfilingApiCall target =
reinterpret_cast<SimulatorRuntimeProfilingApiCall>(external);
target(arg0, Redirection::ReverseRedirection(arg1));
} else if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) {
if (::v8::internal::FLAG_trace_sim) {
PrintF("Call to host function at %p args %08" PRIx64 " %08" PRIx64
" \n",
reinterpret_cast<void*>(external), arg0, arg1);
}
SimulatorRuntimeDirectGetterCall target =
reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external);
target(arg0, arg1);
} else if (redirection->type() ==
ExternalReference::PROFILING_GETTER_CALL) {
if (::v8::internal::FLAG_trace_sim) {
PrintF("Call to host function at %p args %08" PRIx64 " %08" PRIx64
" %08" PRIx64 " \n",
reinterpret_cast<void*>(external), arg0, arg1, arg2);
}
SimulatorRuntimeProfilingGetterCall target =
reinterpret_cast<SimulatorRuntimeProfilingGetterCall>(external);
target(arg0, arg1, Redirection::ReverseRedirection(arg2));
} else {
DCHECK(redirection->type() == ExternalReference::BUILTIN_CALL ||
redirection->type() == ExternalReference::BUILTIN_CALL_PAIR);
SimulatorRuntimeCall target =
reinterpret_cast<SimulatorRuntimeCall>(external);
if (::v8::internal::FLAG_trace_sim) {
PrintF(
"Call to host function at %p "
"args %08" PRIx64 " , %08" PRIx64 " , %08" PRIx64 " , %08" PRIx64
" , %08" PRIx64 " , %08" PRIx64 " , %08" PRIx64 " , %08" PRIx64
" , %08" PRIx64 " , %08" PRIx64 " \n",
reinterpret_cast<void*>(FUNCTION_ADDR(target)), arg0, arg1, arg2,
arg3, arg4, arg5, arg6, arg7, arg8, arg9);
}
ObjectPair result =
target(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
set_register(v0, (int64_t)(result.x));
set_register(v1, (int64_t)(result.y));
}
if (::v8::internal::FLAG_trace_sim) {
PrintF("Returned %08" PRIx64 " : %08" PRIx64 " \n", get_register(v1),
get_register(v0));
}
set_register(ra, saved_ra);
set_pc(get_register(ra));
} else if (func == BREAK && code <= kMaxStopCode) {
if (IsWatchpoint(code)) {
PrintWatchpoint(code);
} else {
IncreaseStopCounter(code);
HandleStop(code, instr_.instr());
}
} else {
// All remaining break_ codes, and all traps are handled here.
MipsDebugger dbg(this);
dbg.Debug();
}
}
// Stop helper functions.
bool Simulator::IsWatchpoint(uint64_t code) {
return (code <= kMaxWatchpointCode);
}
void Simulator::PrintWatchpoint(uint64_t code) {
MipsDebugger dbg(this);
++break_count_;
PrintF("\n---- break %" PRId64 " marker: %3d (instr count: %8" PRId64
" ) ----------"
"----------------------------------",
code, break_count_, icount_);
dbg.PrintAllRegs(); // Print registers and continue running.
}
void Simulator::HandleStop(uint64_t code, Instruction* instr) {
// Stop if it is enabled, otherwise go on jumping over the stop
// and the message address.
if (IsEnabledStop(code)) {
MipsDebugger dbg(this);
dbg.Stop(instr);
}
}
bool Simulator::IsStopInstruction(Instruction* instr) {
int32_t func = instr->FunctionFieldRaw();
uint32_t code = static_cast<uint32_t>(instr->Bits(25, 6));
return (func == BREAK) && code > kMaxWatchpointCode && code <= kMaxStopCode;
}
bool Simulator::IsEnabledStop(uint64_t code) {
DCHECK_LE(code, kMaxStopCode);
DCHECK_GT(code, kMaxWatchpointCode);
return !(watched_stops_[code].count & kStopDisabledBit);
}
void Simulator::EnableStop(uint64_t code) {
if (!IsEnabledStop(code)) {
watched_stops_[code].count &= ~kStopDisabledBit;
}
}
void Simulator::DisableStop(uint64_t code) {
if (IsEnabledStop(code)) {
watched_stops_[code].count |= kStopDisabledBit;
}
}
void Simulator::IncreaseStopCounter(uint64_t code) {
DCHECK_LE(code, kMaxStopCode);
if ((watched_stops_[code].count & ~(1 << 31)) == 0x7FFFFFFF) {
PrintF("Stop counter for code %" PRId64
" has overflowed.\n"
"Enabling this code and reseting the counter to 0.\n",
code);
watched_stops_[code].count = 0;
EnableStop(code);
} else {
watched_stops_[code].count++;
}
}
// Print a stop status.
void Simulator::PrintStopInfo(uint64_t code) {
if (code <= kMaxWatchpointCode) {
PrintF("That is a watchpoint, not a stop.\n");
return;
} else if (code > kMaxStopCode) {
PrintF("Code too large, only %u stops can be used\n", kMaxStopCode + 1);
return;
}
const char* state = IsEnabledStop(code) ? "Enabled" : "Disabled";
int32_t count = watched_stops_[code].count & ~kStopDisabledBit;
// Don't print the state of unused breakpoints.
if (count != 0) {
if (watched_stops_[code].desc) {
PrintF("stop %" PRId64 " - 0x%" PRIx64 " : \t%s, \tcounter = %i, \t%s\n",
code, code, state, count, watched_stops_[code].desc);
} else {
PrintF("stop %" PRId64 " - 0x%" PRIx64 " : \t%s, \tcounter = %i\n", code,
code, state, count);
}
}
}
void Simulator::SignalException(Exception e) {
FATAL("Error: Exception %i raised.", static_cast<int>(e));
}
// Min/Max template functions for Double and Single arguments.
template <typename T>
static T FPAbs(T a);
template <>
double FPAbs<double>(double a) {
return fabs(a);
}
template <>
float FPAbs<float>(float a) {
return fabsf(a);
}
template <typename T>
static bool FPUProcessNaNsAndZeros(T a, T b, MaxMinKind kind, T* result) {
if (std::isnan(a) && std::isnan(b)) {
*result = a;
} else if (std::isnan(a)) {
*result = b;
} else if (std::isnan(b)) {
*result = a;
} else if (b == a) {
// Handle -0.0 == 0.0 case.
// std::signbit() returns int 0 or 1 so subtracting MaxMinKind::kMax
// negates the result.
*result = std::signbit(b) - static_cast<int>(kind) ? b : a;
} else {
return false;
}
return true;
}
template <typename T>
static T FPUMin(T a, T b) {
T result;
if (FPUProcessNaNsAndZeros(a, b, MaxMinKind::kMin, &result)) {
return result;
} else {
return b < a ? b : a;
}
}
template <typename T>
static T FPUMax(T a, T b) {
T result;
if (FPUProcessNaNsAndZeros(a, b, MaxMinKind::kMax, &result)) {
return result;
} else {
return b > a ? b : a;
}
}
template <typename T>
static T FPUMinA(T a, T b) {
T result;
if (!FPUProcessNaNsAndZeros(a, b, MaxMinKind::kMin, &result)) {
if (FPAbs(a) < FPAbs(b)) {
result = a;
} else if (FPAbs(b) < FPAbs(a)) {
result = b;
} else {
result = a < b ? a : b;
}
}
return result;
}
template <typename T>
static T FPUMaxA(T a, T b) {
T result;
if (!FPUProcessNaNsAndZeros(a, b, MaxMinKind::kMin, &result)) {
if (FPAbs(a) > FPAbs(b)) {
result = a;
} else if (FPAbs(b) > FPAbs(a)) {
result = b;
} else {
result = a > b ? a : b;
}
}
return result;
}
enum class KeepSign : bool { no = false, yes };
template <typename T, typename std::enable_if<std::is_floating_point<T>::value,
int>::type = 0>
T FPUCanonalizeNaNArg(T result, T arg, KeepSign keepSign = KeepSign::no) {
DCHECK(std::isnan(arg));
T qNaN = std::numeric_limits<T>::quiet_NaN();
if (keepSign == KeepSign::yes) {
return std::copysign(qNaN, result);
}
return qNaN;
}
template <typename T>
T FPUCanonalizeNaNArgs(T result, KeepSign keepSign, T first) {
if (std::isnan(first)) {
return FPUCanonalizeNaNArg(result, first, keepSign);
}
return result;
}
template <typename T, typename... Args>
T FPUCanonalizeNaNArgs(T result, KeepSign keepSign, T first, Args... args) {
if (std::isnan(first)) {
return FPUCanonalizeNaNArg(result, first, keepSign);
}
return FPUCanonalizeNaNArgs(result, keepSign, args...);
}
template <typename Func, typename T, typename... Args>
T FPUCanonalizeOperation(Func f, T first, Args... args) {
return FPUCanonalizeOperation(f, KeepSign::no, first, args...);
}
template <typename Func, typename T, typename... Args>
T FPUCanonalizeOperation(Func f, KeepSign keepSign, T first, Args... args) {
T result = f(first, args...);
if (std::isnan(result)) {
result = FPUCanonalizeNaNArgs(result, keepSign, first, args...);
}
return result;
}
// Handle execution based on instruction types.
void Simulator::DecodeTypeRegisterSRsType() {
float fs, ft, fd;
fs = get_fpu_register_float(fs_reg());
ft = get_fpu_register_float(ft_reg());
fd = get_fpu_register_float(fd_reg());
int32_t ft_int = bit_cast<int32_t>(ft);
int32_t fd_int = bit_cast<int32_t>(fd);
uint32_t cc, fcsr_cc;
cc = instr_.FCccValue();
fcsr_cc = get_fcsr_condition_bit(cc);
switch (instr_.FunctionFieldRaw()) {
case RINT: {
DCHECK_EQ(kArchVariant, kMips64r6);
float result, temp_result;
double temp;
float upper = std::ceil(fs);
float lower = std::floor(fs);
switch (get_fcsr_rounding_mode()) {
case kRoundToNearest:
if (upper - fs < fs - lower) {
result = upper;
} else if (upper - fs > fs - lower) {
result = lower;
} else {
temp_result = upper / 2;
float reminder = modf(temp_result, &temp);
if (reminder == 0) {
result = upper;
} else {
result = lower;
}
}
break;
case kRoundToZero:
result = (fs > 0 ? lower : upper);
break;
case kRoundToPlusInf:
result = upper;
break;
case kRoundToMinusInf:
result = lower;
break;
}
SetFPUFloatResult(fd_reg(), result);
if (result != fs) {
set_fcsr_bit(kFCSRInexactFlagBit, true);
}
break;
}
case ADD_S:
SetFPUFloatResult(
fd_reg(),
FPUCanonalizeOperation([](float lhs, float rhs) { return lhs + rhs; },
fs, ft));
break;
case SUB_S:
SetFPUFloatResult(
fd_reg(),
FPUCanonalizeOperation([](float lhs, float rhs) { return lhs - rhs; },
fs, ft));
break;
case MADDF_S:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUFloatResult(fd_reg(), std::fma(fs, ft, fd));
break;
case MSUBF_S:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUFloatResult(fd_reg(), std::fma(-fs, ft, fd));
break;
case MUL_S:
SetFPUFloatResult(
fd_reg(),
FPUCanonalizeOperation([](float lhs, float rhs) { return lhs * rhs; },
fs, ft));
break;
case DIV_S:
SetFPUFloatResult(
fd_reg(),
FPUCanonalizeOperation([](float lhs, float rhs) { return lhs / rhs; },
fs, ft));
break;
case ABS_S:
SetFPUFloatResult(fd_reg(), FPUCanonalizeOperation(
[](float fs) { return FPAbs(fs); }, fs));
break;
case MOV_S:
SetFPUFloatResult(fd_reg(), fs);
break;
case NEG_S:
SetFPUFloatResult(fd_reg(),
FPUCanonalizeOperation([](float src) { return -src; },
KeepSign::yes, fs));
break;
case SQRT_S:
SetFPUFloatResult(
fd_reg(),
FPUCanonalizeOperation([](float src) { return std::sqrt(src); }, fs));
break;
case RSQRT_S:
SetFPUFloatResult(
fd_reg(), FPUCanonalizeOperation(
[](float src) { return 1.0 / std::sqrt(src); }, fs));
break;
case RECIP_S:
SetFPUFloatResult(fd_reg(), FPUCanonalizeOperation(
[](float src) { return 1.0 / src; }, fs));
break;
case C_F_D:
set_fcsr_bit(fcsr_cc, false);
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case C_UN_D:
set_fcsr_bit(fcsr_cc, std::isnan(fs) || std::isnan(ft));
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case C_EQ_D:
set_fcsr_bit(fcsr_cc, (fs == ft));
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case C_UEQ_D:
set_fcsr_bit(fcsr_cc, (fs == ft) || (std::isnan(fs) || std::isnan(ft)));
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case C_OLT_D:
set_fcsr_bit(fcsr_cc, (fs < ft));
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case C_ULT_D:
set_fcsr_bit(fcsr_cc, (fs < ft) || (std::isnan(fs) || std::isnan(ft)));
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case C_OLE_D:
set_fcsr_bit(fcsr_cc, (fs <= ft));
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case C_ULE_D:
set_fcsr_bit(fcsr_cc, (fs <= ft) || (std::isnan(fs) || std::isnan(ft)));
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case CVT_D_S:
SetFPUDoubleResult(fd_reg(), static_cast<double>(fs));
break;
case CLASS_S: { // Mips64r6 instruction
// Convert float input to uint32_t for easier bit manipulation
uint32_t classed = bit_cast<uint32_t>(fs);
// Extracting sign, exponent and mantissa from the input float
uint32_t sign = (classed >> 31) & 1;
uint32_t exponent = (classed >> 23) & 0x000000FF;
uint32_t mantissa = classed & 0x007FFFFF;
uint32_t result;
float fResult;
// Setting flags if input float is negative infinity,
// positive infinity, negative zero or positive zero
bool negInf = (classed == 0xFF800000);
bool posInf = (classed == 0x7F800000);
bool negZero = (classed == 0x80000000);
bool posZero = (classed == 0x00000000);
bool signalingNan;
bool quietNan;
bool negSubnorm;
bool posSubnorm;
bool negNorm;
bool posNorm;
// Setting flags if float is NaN
signalingNan = false;
quietNan = false;
if (!negInf && !posInf && (exponent == 0xFF)) {
quietNan = ((mantissa & 0x00200000) == 0) &&
((mantissa & (0x00200000 - 1)) == 0);
signalingNan = !quietNan;
}
// Setting flags if float is subnormal number
posSubnorm = false;
negSubnorm = false;
if ((exponent == 0) && (mantissa != 0)) {
DCHECK(sign == 0 || sign == 1);
posSubnorm = (sign == 0);
negSubnorm = (sign == 1);
}
// Setting flags if float is normal number
posNorm = false;
negNorm = false;
if (!posSubnorm && !negSubnorm && !posInf && !negInf && !signalingNan &&
!quietNan && !negZero && !posZero) {
DCHECK(sign == 0 || sign == 1);
posNorm = (sign == 0);
negNorm = (sign == 1);
}
// Calculating result according to description of CLASS.S instruction
result = (posZero << 9) | (posSubnorm << 8) | (posNorm << 7) |
(posInf << 6) | (negZero << 5) | (negSubnorm << 4) |
(negNorm << 3) | (negInf << 2) | (quietNan << 1) | signalingNan;
DCHECK_NE(result, 0);
fResult = bit_cast<float>(result);
SetFPUFloatResult(fd_reg(), fResult);
break;
}
case CVT_L_S: {
float rounded;
int64_t result;
round64_according_to_fcsr(fs, &rounded, &result, fs);
SetFPUResult(fd_reg(), result);
if (set_fcsr_round64_error(fs, rounded)) {
set_fpu_register_invalid_result64(fs, rounded);
}
break;
}
case CVT_W_S: {
float rounded;
int32_t result;
round_according_to_fcsr(fs, &rounded, &result, fs);
SetFPUWordResult(fd_reg(), result);
if (set_fcsr_round_error(fs, rounded)) {
set_fpu_register_word_invalid_result(fs, rounded);
}
break;
}
case TRUNC_W_S: { // Truncate single to word (round towards 0).
float rounded = trunc(fs);
int32_t result = static_cast<int32_t>(rounded);
SetFPUWordResult(fd_reg(), result);
if (set_fcsr_round_error(fs, rounded)) {
set_fpu_register_word_invalid_result(fs, rounded);
}
} break;
case TRUNC_L_S: { // Mips64r2 instruction.
float rounded = trunc(fs);
int64_t result = static_cast<int64_t>(rounded);
SetFPUResult(fd_reg(), result);
if (set_fcsr_round64_error(fs, rounded)) {
set_fpu_register_invalid_result64(fs, rounded);
}
break;
}
case ROUND_W_S: {
float rounded = std::floor(fs + 0.5);
int32_t result = static_cast<int32_t>(rounded);
if ((result & 1) != 0 && result - fs == 0.5) {
// If the number is halfway between two integers,
// round to the even one.
result--;
}
SetFPUWordResult(fd_reg(), result);
if (set_fcsr_round_error(fs, rounded)) {
set_fpu_register_word_invalid_result(fs, rounded);
}
break;
}
case ROUND_L_S: { // Mips64r2 instruction.
float rounded = std::floor(fs + 0.5);
int64_t result = static_cast<int64_t>(rounded);
if ((result & 1) != 0 && result - fs == 0.5) {
// If the number is halfway between two integers,
// round to the even one.
result--;
}
int64_t i64 = static_cast<int64_t>(result);
SetFPUResult(fd_reg(), i64);
if (set_fcsr_round64_error(fs, rounded)) {
set_fpu_register_invalid_result64(fs, rounded);
}
break;
}
case FLOOR_L_S: { // Mips64r2 instruction.
float rounded = floor(fs);
int64_t result = static_cast<int64_t>(rounded);
SetFPUResult(fd_reg(), result);
if (set_fcsr_round64_error(fs, rounded)) {
set_fpu_register_invalid_result64(fs, rounded);
}
break;
}
case FLOOR_W_S: // Round double to word towards negative infinity.
{
float rounded = std::floor(fs);
int32_t result = static_cast<int32_t>(rounded);
SetFPUWordResult(fd_reg(), result);
if (set_fcsr_round_error(fs, rounded)) {
set_fpu_register_word_invalid_result(fs, rounded);
}
} break;
case CEIL_W_S: // Round double to word towards positive infinity.
{
float rounded = std::ceil(fs);
int32_t result = static_cast<int32_t>(rounded);
SetFPUWordResult(fd_reg(), result);
if (set_fcsr_round_error(fs, rounded)) {
set_fpu_register_invalid_result(fs, rounded);
}
} break;
case CEIL_L_S: { // Mips64r2 instruction.
float rounded = ceil(fs);
int64_t result = static_cast<int64_t>(rounded);
SetFPUResult(fd_reg(), result);
if (set_fcsr_round64_error(fs, rounded)) {
set_fpu_register_invalid_result64(fs, rounded);
}
break;
}
case MINA:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUFloatResult(fd_reg(), FPUMinA(ft, fs));
break;
case MAXA:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUFloatResult(fd_reg(), FPUMaxA(ft, fs));
break;
case MIN:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUFloatResult(fd_reg(), FPUMin(ft, fs));
break;
case MAX:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUFloatResult(fd_reg(), FPUMax(ft, fs));
break;
case SEL:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUFloatResult(fd_reg(), (fd_int & 0x1) == 0 ? fs : ft);
break;
case SELEQZ_C:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUFloatResult(fd_reg(), (ft_int & 0x1) == 0
? get_fpu_register_float(fs_reg())
: 0.0);
break;
case SELNEZ_C:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUFloatResult(fd_reg(), (ft_int & 0x1) != 0
? get_fpu_register_float(fs_reg())
: 0.0);
break;
case MOVZ_C: {
DCHECK_EQ(kArchVariant, kMips64r2);
if (rt() == 0) {
SetFPUFloatResult(fd_reg(), fs);
}
break;
}
case MOVN_C: {
DCHECK_EQ(kArchVariant, kMips64r2);
if (rt() != 0) {
SetFPUFloatResult(fd_reg(), fs);
}
break;
}
case MOVF: {
// Same function field for MOVT.D and MOVF.D
uint32_t ft_cc = (ft_reg() >> 2) & 0x7;
ft_cc = get_fcsr_condition_bit(ft_cc);
if (instr_.Bit(16)) { // Read Tf bit.
// MOVT.D
if (test_fcsr_bit(ft_cc)) SetFPUFloatResult(fd_reg(), fs);
} else {
// MOVF.D
if (!test_fcsr_bit(ft_cc)) SetFPUFloatResult(fd_reg(), fs);
}
break;
}
default:
// TRUNC_W_S ROUND_W_S ROUND_L_S FLOOR_W_S FLOOR_L_S
// CEIL_W_S CEIL_L_S CVT_PS_S are unimplemented.
UNREACHABLE();
}
}
void Simulator::DecodeTypeRegisterDRsType() {
double ft, fs, fd;
uint32_t cc, fcsr_cc;
fs = get_fpu_register_double(fs_reg());
ft = (instr_.FunctionFieldRaw() != MOVF) ? get_fpu_register_double(ft_reg())
: 0.0;
fd = get_fpu_register_double(fd_reg());
cc = instr_.FCccValue();
fcsr_cc = get_fcsr_condition_bit(cc);
int64_t ft_int = bit_cast<int64_t>(ft);
int64_t fd_int = bit_cast<int64_t>(fd);
switch (instr_.FunctionFieldRaw()) {
case RINT: {
DCHECK_EQ(kArchVariant, kMips64r6);
double result, temp, temp_result;
double upper = std::ceil(fs);
double lower = std::floor(fs);
switch (get_fcsr_rounding_mode()) {
case kRoundToNearest:
if (upper - fs < fs - lower) {
result = upper;
} else if (upper - fs > fs - lower) {
result = lower;
} else {
temp_result = upper / 2;
double reminder = modf(temp_result, &temp);
if (reminder == 0) {
result = upper;
} else {
result = lower;
}
}
break;
case kRoundToZero:
result = (fs > 0 ? lower : upper);
break;
case kRoundToPlusInf:
result = upper;
break;
case kRoundToMinusInf:
result = lower;
break;
}
SetFPUDoubleResult(fd_reg(), result);
if (result != fs) {
set_fcsr_bit(kFCSRInexactFlagBit, true);
}
break;
}
case SEL:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUDoubleResult(fd_reg(), (fd_int & 0x1) == 0 ? fs : ft);
break;
case SELEQZ_C:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUDoubleResult(fd_reg(), (ft_int & 0x1) == 0 ? fs : 0.0);
break;
case SELNEZ_C:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUDoubleResult(fd_reg(), (ft_int & 0x1) != 0 ? fs : 0.0);
break;
case MOVZ_C: {
DCHECK_EQ(kArchVariant, kMips64r2);
if (rt() == 0) {
SetFPUDoubleResult(fd_reg(), fs);
}
break;
}
case MOVN_C: {
DCHECK_EQ(kArchVariant, kMips64r2);
if (rt() != 0) {
SetFPUDoubleResult(fd_reg(), fs);
}
break;
}
case MOVF: {
// Same function field for MOVT.D and MOVF.D
uint32_t ft_cc = (ft_reg() >> 2) & 0x7;
ft_cc = get_fcsr_condition_bit(ft_cc);
if (instr_.Bit(16)) { // Read Tf bit.
// MOVT.D
if (test_fcsr_bit(ft_cc)) SetFPUDoubleResult(fd_reg(), fs);
} else {
// MOVF.D
if (!test_fcsr_bit(ft_cc)) SetFPUDoubleResult(fd_reg(), fs);
}
break;
}
case MINA:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUDoubleResult(fd_reg(), FPUMinA(ft, fs));
break;
case MAXA:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUDoubleResult(fd_reg(), FPUMaxA(ft, fs));
break;
case MIN:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUDoubleResult(fd_reg(), FPUMin(ft, fs));
break;
case MAX:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUDoubleResult(fd_reg(), FPUMax(ft, fs));
break;
case ADD_D:
SetFPUDoubleResult(
fd_reg(),
FPUCanonalizeOperation(
[](double lhs, double rhs) { return lhs + rhs; }, fs, ft));
break;
case SUB_D:
SetFPUDoubleResult(
fd_reg(),
FPUCanonalizeOperation(
[](double lhs, double rhs) { return lhs - rhs; }, fs, ft));
break;
case MADDF_D:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUDoubleResult(fd_reg(), std::fma(fs, ft, fd));
break;
case MSUBF_D:
DCHECK_EQ(kArchVariant, kMips64r6);
SetFPUDoubleResult(fd_reg(), std::fma(-fs, ft, fd));
break;
case MUL_D:
SetFPUDoubleResult(
fd_reg(),
FPUCanonalizeOperation(
[](double lhs, double rhs) { return lhs * rhs; }, fs, ft));
break;
case DIV_D:
SetFPUDoubleResult(
fd_reg(),
FPUCanonalizeOperation(
[](double lhs, double rhs) { return lhs / rhs; }, fs, ft));
break;
case ABS_D:
SetFPUDoubleResult(
fd_reg(),
FPUCanonalizeOperation([](double fs) { return FPAbs(fs); }, fs));
break;
case MOV_D:
SetFPUDoubleResult(fd_reg(), fs);
break;
case NEG_D:
SetFPUDoubleResult(fd_reg(),
FPUCanonalizeOperation([](double src) { return -src; },
KeepSign::yes, fs));
break;
case SQRT_D:
SetFPUDoubleResult(
fd_reg(),
FPUCanonalizeOperation([](double fs) { return std::sqrt(fs); }, fs));
break;
case RSQRT_D:
SetFPUDoubleResult(
fd_reg(), FPUCanonalizeOperation(
[](double fs) { return 1.0 / std::sqrt(fs); }, fs));
break;
case RECIP_D:
SetFPUDoubleResult(fd_reg(), FPUCanonalizeOperation(
[](double fs) { return 1.0 / fs; }, fs));
break;
case C_UN_D:
set_fcsr_bit(fcsr_cc, std::isnan(fs) || std::isnan(ft));
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case C_EQ_D:
set_fcsr_bit(fcsr_cc, (fs == ft));
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case C_UEQ_D:
set_fcsr_bit(fcsr_cc, (fs == ft) || (std::isnan(fs) || std::isnan(ft)));
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case C_OLT_D:
set_fcsr_bit(fcsr_cc, (fs < ft));
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case C_ULT_D:
set_fcsr_bit(fcsr_cc, (fs < ft) || (std::isnan(fs) || std::isnan(ft)));
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case C_OLE_D:
set_fcsr_bit(fcsr_cc, (fs <= ft));
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case C_ULE_D:
set_fcsr_bit(fcsr_cc, (fs <= ft) || (std::isnan(fs) || std::isnan(ft)));
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
case CVT_W_D: { // Convert double to word.
double rounded;
int32_t result;
round_according_to_fcsr(fs, &rounded, &result, fs);
SetFPUWordResult(fd_reg(), result);
if (set_fcsr_round_error(fs, rounded)) {
set_fpu_register_word_invalid_result(fs, rounded);
}
break;
}
case ROUND_W_D: // Round double to word (round half to even).
{
double rounded = std::floor(fs + 0.5);
int32_t result = static_cast<int32_t>(rounded);
if ((result & 1) != 0 && result - fs == 0.5) {
// If the number is halfway between two integers,
// round to the even one.
result--;
}
SetFPUWordResult(fd_reg(), result);
if (set_fcsr_round_error(fs, rounded)) {
set_fpu_register_invalid_result(fs, rounded);
}
} break;
case TRUNC_W_D: // Truncate double to word (round towards 0).
{
double rounded = trunc(fs);
int32_t result = static_cast<int32_t>(rounded);
SetFPUWordResult(fd_reg(), result);
if (set_fcsr_round_error(fs, rounded)) {
set_fpu_register_invalid_result(fs, rounded);
}
} break;
case FLOOR_W_D: // Round double to word towards negative infinity.
{
double rounded = std::floor(fs);
int32_t result = static_cast<int32_t>(rounded);
SetFPUWordResult(fd_reg(), result);
if (set_fcsr_round_error(fs, rounded)) {
set_fpu_register_invalid_result(fs, rounded);
}
} break;
case CEIL_W_D: // Round double to word towards positive infinity.
{
double rounded = std::ceil(fs);
int32_t result = static_cast<int32_t>(rounded);
SetFPUWordResult2(fd_reg(), result);
if (set_fcsr_round_error(fs, rounded)) {
set_fpu_register_invalid_result(fs, rounded);
}
} break;
case CVT_S_D: // Convert double to float (single).
SetFPUFloatResult(fd_reg(), static_cast<float>(fs));
break;
case CVT_L_D: { // Mips64r2: Truncate double to 64-bit long-word.
double rounded;
int64_t result;
round64_according_to_fcsr(fs, &rounded, &result, fs);
SetFPUResult(fd_reg(), result);
if (set_fcsr_round64_error(fs, rounded)) {
set_fpu_register_invalid_result64(fs, rounded);
}
break;
}
case ROUND_L_D: { // Mips64r2 instruction.
double rounded = std::floor(fs + 0.5);
int64_t result = static_cast<int64_t>(rounded);
if ((result & 1) != 0 && result - fs == 0.5) {
// If the number is halfway between two integers,
// round to the even one.
result--;
}
int64_t i64 = static_cast<int64_t>(result);
SetFPUResult(fd_reg(), i64);
if (set_fcsr_round64_error(fs, rounded)) {
set_fpu_register_invalid_result64(fs, rounded);
}
break;
}
case TRUNC_L_D: { // Mips64r2 instruction.
double rounded = trunc(fs);
int64_t result = static_cast<int64_t>(rounded);
SetFPUResult(fd_reg(), result);
if (set_fcsr_round64_error(fs, rounded)) {
set_fpu_register_invalid_result64(fs, rounded);
}
break;
}
case FLOOR_L_D: { // Mips64r2 instruction.
double rounded = floor(fs);
int64_t result = static_cast<int64_t>(rounded);
SetFPUResult(fd_reg(), result);
if (set_fcsr_round64_error(fs, rounded)) {
set_fpu_register_invalid_result64(fs, rounded);
}
break;
}
case CEIL_L_D: { // Mips64r2 instruction.
double rounded = ceil(fs);
int64_t result = static_cast<int64_t>(rounded);
SetFPUResult(fd_reg(), result);
if (set_fcsr_round64_error(fs, rounded)) {
set_fpu_register_invalid_result64(fs, rounded);
}
break;
}
case CLASS_D: { // Mips64r6 instruction
// Convert double input to uint64_t for easier bit manipulation
uint64_t classed = bit_cast<uint64_t>(fs);
// Extracting sign, exponent and mantissa from the input double
uint32_t sign = (classed >> 63) & 1;
uint32_t exponent = (classed >> 52) & 0x00000000000007FF;
uint64_t mantissa = classed & 0x000FFFFFFFFFFFFF;
uint64_t result;
double dResult;
// Setting flags if input double is negative infinity,
// positive infinity, negative zero or positive zero
bool negInf = (classed == 0xFFF0000000000000);
bool posInf = (classed == 0x7FF0000000000000);
bool negZero = (classed == 0x8000000000000000);
bool posZero = (classed == 0x0000000000000000);
bool signalingNan;
bool quietNan;
bool negSubnorm;
bool posSubnorm;
bool negNorm;
bool posNorm;
// Setting flags if double is NaN
signalingNan = false;
quietNan = false;
if (!negInf && !posInf && exponent == 0x7FF) {
quietNan = ((mantissa & 0x0008000000000000) != 0) &&
((mantissa & (0x0008000000000000 - 1)) == 0);
signalingNan = !quietNan;
}
// Setting flags if double is subnormal number
posSubnorm = false;
negSubnorm = false;
if ((exponent == 0) && (mantissa != 0)) {
DCHECK(sign == 0 || sign == 1);
posSubnorm = (sign == 0);
negSubnorm = (sign == 1);
}
// Setting flags if double is normal number
posNorm = false;
negNorm = false;
if (!posSubnorm && !negSubnorm && !posInf && !negInf && !signalingNan &&
!quietNan && !negZero && !posZero) {
DCHECK(sign == 0 || sign == 1);
posNorm = (sign == 0);
negNorm = (sign == 1);
}
// Calculating result according to description of CLASS.D instruction
result = (posZero << 9) | (posSubnorm << 8) | (posNorm << 7) |
(posInf << 6) | (negZero << 5) | (negSubnorm << 4) |
(negNorm << 3) | (negInf << 2) | (quietNan << 1) | signalingNan;
DCHECK_NE(result, 0);
dResult = bit_cast<double>(result);
SetFPUDoubleResult(fd_reg(), dResult);
break;
}
case C_F_D: {
set_fcsr_bit(fcsr_cc, false);
TraceRegWr(test_fcsr_bit(fcsr_cc));
break;
}
default:
UNREACHABLE();
}
}
void Simulator::DecodeTypeRegisterWRsType() {
float fs = get_fpu_register_float(fs_reg());
float ft = get_fpu_register_float(ft_reg());
int64_t alu_out = 0x12345678;
switch (instr_.FunctionFieldRaw()) {
case CVT_S_W: // Convert word to float (single).
alu_out = get_fpu_register_signed_word(fs_reg());
SetFPUFloatResult(fd_reg(), static_cast<float>(alu_out));
break;
case CVT_D_W: // Convert word to double.
alu_out = get_fpu_register_signed_word(fs_reg());
SetFPUDoubleResult(fd_reg(), static_cast<double>(alu_out));
break;
case CMP_AF:
SetFPUWordResult2(fd_reg(), 0);
break;
case CMP_UN:
if (std::isnan(fs) || std::isnan(ft)) {
SetFPUWordResult2(fd_reg(), -1);
} else {
SetFPUWordResult2(fd_reg(), 0);
}
break;
case CMP_EQ:
if (fs == ft) {
SetFPUWordResult2(fd_reg(), -1);
} else {
SetFPUWordResult2(fd_reg(), 0);
}
break;
case CMP_UEQ:
if ((fs == ft) || (std::isnan(fs) || std::isnan(ft))) {
SetFPUWordResult2(fd_reg(), -1);
} else {
SetFPUWordResult2(fd_reg(), 0);
}
break;
case CMP_LT:
if (fs < ft) {
SetFPUWordResult2(fd_reg(), -1);
} else {
SetFPUWordResult2(fd_reg(), 0);
}
break;
case CMP_ULT:
if ((fs < ft) || (std::isnan(fs) || std::isnan(ft))) {
SetFPUWordResult2(fd_reg(), -1);
} else {
SetFPUWordResult2(fd_reg(), 0);
}
break;
case CMP_LE:
if (fs <= ft) {
SetFPUWordResult2(fd_reg(), -1);
} else {
SetFPUWordResult2(fd_reg(), 0);
}
break;
case CMP_ULE:
if ((fs <= ft) || (std::isnan(fs) || std::isnan(ft))) {
SetFPUWordResult2(fd_reg(), -1);
} else {
SetFPUWordResult2(fd_reg(), 0);
}
break;
case CMP_OR:
if (!std::isnan(fs) && !std::isnan(ft)) {
SetFPUWordResult2(fd_reg(), -1);
} else {
SetFPUWordResult2(fd_reg(), 0);
}
break;
case CMP_UNE:
if ((fs != ft) || (std::isnan(fs) || std::isnan(ft))) {
SetFPUWordResult2(fd_reg(), -1);
} else {
SetFPUWordResult2(fd_reg(), 0);
}
break;
case CMP_NE:
if (fs != ft) {
SetFPUWordResult2(fd_reg(), -1);
} else {
SetFPUWordResult2(fd_reg(), 0);
}
break;
default:
UNREACHABLE();
}
}
void Simulator::DecodeTypeRegisterLRsType() {
double fs = get_fpu_register_double(fs_reg());
double ft = get_fpu_register_double(ft_reg());
int64_t i64;
switch (instr_.FunctionFieldRaw()) {
case CVT_D_L: // Mips32r2 instruction.
i64 = get_fpu_register(fs_reg());
SetFPUDoubleResult(fd_reg(), static_cast<double>(i64));
break;
case CVT_S_L:
i64 = get_fpu_register(fs_reg());
SetFPUFloatResult(fd_reg(), static_cast<float>(i64));
break;
case CMP_AF:
SetFPUResult(fd_reg(), 0);
break;
case CMP_UN:
if (std::isnan(fs) || std::isnan(ft)) {
SetFPUResult(fd_reg(), -1);
} else {
SetFPUResult(fd_reg(), 0);
}
break;
case CMP_EQ:
if (fs == ft) {
SetFPUResult(fd_reg(), -1);
} else {
SetFPUResult(fd_reg(), 0);
}
break;
case CMP_UEQ:
if ((fs == ft) || (std::isnan(fs) || std::isnan(ft))) {
SetFPUResult(fd_reg(), -1);
} else {
SetFPUResult(fd_reg(), 0);
}
break;
case CMP_LT:
if (fs < ft) {
SetFPUResult(fd_reg(), -1);
} else {
SetFPUResult(fd_reg(), 0);
}
break;
case CMP_ULT:
if ((fs < ft) || (std::isnan(fs) || std::isnan(ft))) {
SetFPUResult(fd_reg(), -1);
} else {
SetFPUResult(fd_reg(), 0);
}
break;
case CMP_LE:
if (fs <= ft) {
SetFPUResult(fd_reg(), -1);
} else {
SetFPUResult(fd_reg(), 0);
}
break;
case CMP_ULE:
if ((fs <= ft) || (std::isnan(fs) || std::isnan(ft))) {
SetFPUResult(fd_reg(), -1);
} else {
SetFPUResult(fd_reg(), 0);
}
break;
case CMP_OR:
if (!std::isnan(fs) && !std::isnan(ft)) {
SetFPUResult(fd_reg(), -1);
} else {
SetFPUResult(fd_reg(), 0);
}
break;
case CMP_UNE:
if ((fs != ft) || (std::isnan(fs) || std::isnan(ft))) {
SetFPUResult(fd_reg(), -1);
} else {
SetFPUResult(fd_reg(), 0);
}
break;
case CMP_NE:
if (fs != ft && (!std::isnan(fs) && !std::isnan(ft))) {
SetFPUResult(fd_reg(), -1);
} else {
SetFPUResult(fd_reg(), 0);
}
break;
default:
UNREACHABLE();
}
}
void Simulator::DecodeTypeRegisterCOP1() {
switch (instr_.RsFieldRaw()) {
case BC1: // Branch on coprocessor condition.
case BC1EQZ:
case BC1NEZ:
UNREACHABLE();
case CFC1:
// At the moment only FCSR is supported.
DCHECK_EQ(fs_reg(), kFCSRRegister);
SetResult(rt_reg(), FCSR_);
break;
case MFC1:
set_register(rt_reg(),
static_cast<int64_t>(get_fpu_register_word(fs_reg())));
TraceRegWr(get_register(rt_reg()), WORD_DWORD);
break;
case DMFC1:
SetResult(rt_reg(), get_fpu_register(fs_reg()));
break;
case MFHC1:
SetResult(rt_reg(), get_fpu_register_hi_word(fs_reg()));
break;
case CTC1: {
// At the moment only FCSR is supported.
DCHECK_EQ(fs_reg(), kFCSRRegister);
uint32_t reg = static_cast<uint32_t>(rt());
if (kArchVariant == kMips64r6) {
FCSR_ = reg | kFCSRNaN2008FlagMask;
} else {
DCHECK_EQ(kArchVariant, kMips64r2);
FCSR_ = reg & ~kFCSRNaN2008FlagMask;
}
TraceRegWr(FCSR_);
break;
}
case MTC1:
// Hardware writes upper 32-bits to zero on mtc1.
set_fpu_register_hi_word(fs_reg(), 0);
set_fpu_register_word(fs_reg(), static_cast<int32_t>(rt()));
TraceRegWr(get_fpu_register(fs_reg()), FLOAT_DOUBLE);
break;
case DMTC1:
SetFPUResult2(fs_reg(), rt());
break;
case MTHC1:
set_fpu_register_hi_word(fs_reg(), static_cast<int32_t>(rt()));
TraceRegWr(get_fpu_register(fs_reg()), DOUBLE);
break;
case S:
DecodeTypeRegisterSRsType();
break;
case D:
DecodeTypeRegisterDRsType();
break;
case W:
DecodeTypeRegisterWRsType();
break;
case L:
DecodeTypeRegisterLRsType();
break;
default:
UNREACHABLE();
}
}
void Simulator::DecodeTypeRegisterCOP1X() {
switch (instr_.FunctionFieldRaw()) {
case MADD_S: {
DCHECK_EQ(kArchVariant, kMips64r2);
float fr, ft, fs;
fr = get_fpu_register_float(fr_reg());
fs = get_fpu_register_float(fs_reg());
ft = get_fpu_register_float(ft_reg());
SetFPUFloatResult(fd_reg(), fs * ft + fr);
break;
}
case MSUB_S: {
DCHECK_EQ(kArchVariant, kMips64r2);
float fr, ft, fs;
fr = get_fpu_register_float(fr_reg());
fs = get_fpu_register_float(fs_reg());
ft = get_fpu_register_float(ft_reg());
SetFPUFloatResult(fd_reg(), fs * ft - fr);
break;
}
case MADD_D: {
DCHECK_EQ(kArchVariant, kMips64r2);
double fr, ft, fs;
fr = get_fpu_register_double(fr_reg());
fs = get_fpu_register_double(fs_reg());
ft = get_fpu_register_double(ft_reg());
SetFPUDoubleResult(fd_reg(), fs * ft + fr);
break;
}
case MSUB_D: {
DCHECK_EQ(kArchVariant, kMips64r2);
double fr, ft, fs;
fr = get_fpu_register_double(fr_reg());
fs = get_fpu_register_double(fs_reg());
ft = get_fpu_register_double(ft_reg());
SetFPUDoubleResult(fd_reg(), fs * ft - fr);
break;
}
default:
UNREACHABLE();
}
}
void Simulator::DecodeTypeRegisterSPECIAL() {
int64_t i64hilo;
uint64_t u64hilo;
int64_t alu_out;
bool do_interrupt = false;
switch (instr_.FunctionFieldRaw()) {
case SELEQZ_S:
DCHECK_EQ(kArchVariant, kMips64r6);
SetResult(rd_reg(), rt() == 0 ? rs() : 0);
break;
case SELNEZ_S:
DCHECK_EQ(kArchVariant, kMips64r6);
SetResult(rd_reg(), rt() != 0 ? rs() : 0);
break;
case JR: {
int64_t next_pc = rs();
int64_t current_pc = get_pc();
Instruction* branch_delay_instr =
reinterpret_cast<Instruction*>(current_pc + kInstrSize);
BranchDelayInstructionDecode(branch_delay_instr);
set_pc(next_pc);
pc_modified_ = true;
break;
}
case JALR: {
int64_t next_pc = rs();
int64_t current_pc = get_pc();
int32_t return_addr_reg = rd_reg();
Instruction* branch_delay_instr =
reinterpret_cast<Instruction*>(current_pc + kInstrSize);
BranchDelayInstructionDecode(branch_delay_instr);
set_register(return_addr_reg, current_pc + 2 * kInstrSize);
set_pc(next_pc);
pc_modified_ = true;
break;
}
case SLL:
SetResult(rd_reg(), static_cast<int32_t>(rt()) << sa());
break;
case DSLL:
SetResult(rd_reg(), rt() << sa());
break;
case DSLL32:
SetResult(rd_reg(), rt() << sa() << 32);
break;
case SRL:
if (rs_reg() == 0) {
// Regular logical right shift of a word by a fixed number of
// bits instruction. RS field is always equal to 0.
// Sign-extend the 32-bit result.
alu_out = static_cast<int32_t>(static_cast<uint32_t>(rt_u()) >> sa());
} else if (rs_reg() == 1) {
// Logical right-rotate of a word by a fixed number of bits. This
// is special case of SRL instruction, added in MIPS32 Release 2.
// RS field is equal to 00001.
alu_out = static_cast<int32_t>(
base::bits::RotateRight32(static_cast<const uint32_t>(rt_u()),
static_cast<const uint32_t>(sa())));
} else {
UNREACHABLE();
}
SetResult(rd_reg(), alu_out);
break;
case DSRL:
if (rs_reg() == 0) {
// Regular logical right shift of a word by a fixed number of
// bits instruction. RS field is always equal to 0.
// Sign-extend the 64-bit result.
alu_out = static_cast<int64_t>(rt_u() >> sa());
} else if (rs_reg() == 1) {
// Logical right-rotate of a word by a fixed number of bits. This
// is special case of SRL instruction, added in MIPS32 Release 2.
// RS field is equal to 00001.
alu_out = static_cast<int64_t>(base::bits::RotateRight64(rt_u(), sa()));
} else {
UNREACHABLE();
}
SetResult(rd_reg(), alu_out);
break;
case DSRL32:
if (rs_reg() == 0) {
// Regular logical right shift of a word by a fixed number of
// bits instruction. RS field is always equal to 0.
// Sign-extend the 64-bit result.
alu_out = static_cast<int64_t>(rt_u() >> sa() >> 32);
} else if (rs_reg() == 1) {
// Logical right-rotate of a word by a fixed number of bits. This
// is special case of SRL instruction, added in MIPS32 Release 2.
// RS field is equal to 00001.
alu_out =
static_cast<int64_t>(base::bits::RotateRight64(rt_u(), sa() + 32));
} else {
UNREACHABLE();
}
SetResult(rd_reg(), alu_out);
break;
case SRA:
SetResult(rd_reg(), (int32_t)rt() >> sa());
break;
case DSRA:
SetResult(rd_reg(), rt() >> sa());
break;
case DSRA32:
SetResult(rd_reg(), rt() >> sa() >> 32);
break;
case SLLV:
SetResult(rd_reg(), (int32_t)rt() << rs());
break;
case DSLLV:
SetResult(rd_reg(), rt() << rs());
break;
case SRLV:
if (sa() == 0) {
// Regular logical right-shift of a word by a variable number of
// bits instruction. SA field is always equal to 0.
alu_out = static_cast<int32_t>((uint32_t)rt_u() >> rs());
} else {
// Logical right-rotate of a word by a variable number of bits.
// This is special case od SRLV instruction, added in MIPS32
// Release 2. SA field is equal to 00001.
alu_out = static_cast<int32_t>(
base::bits::RotateRight32(static_cast<const uint32_t>(rt_u()),
static_cast<const uint32_t>(rs_u())));
}
SetResult(rd_reg(), alu_out);
break;
case DSRLV:
if (sa() == 0) {
// Regular logical right-shift of a word by a variable number of
// bits instruction. SA field is always equal to 0.
alu_out = static_cast<int64_t>(rt_u() >> rs());
} else {
// Logical right-rotate of a word by a variable number of bits.
// This is special case od SRLV instruction, added in MIPS32
// Release 2. SA field is equal to 00001.
alu_out =
static_cast<int64_t>(base::bits::RotateRight64(rt_u(), rs_u()));
}
SetResult(rd_reg(), alu_out);
break;
case SRAV:
SetResult(rd_reg(), (int32_t)rt() >> rs());
break;
case DSRAV:
SetResult(rd_reg(), rt() >> rs());
break;
case LSA: {
DCHECK_EQ(kArchVariant, kMips64r6);
int8_t sa = lsa_sa() + 1;
int32_t _rt = static_cast<int32_t>(rt());
int32_t _rs = static_cast<int32_t>(rs());
int32_t res = _rs << sa;
res += _rt;
SetResult(rd_reg(), static_cast<int64_t>(res));
break;
}
case DLSA:
DCHECK_EQ(kArchVariant, kMips64r6);
SetResult(rd_reg(), (rs() << (lsa_sa() + 1)) + rt());
break;
case MFHI: // MFHI == CLZ on R6.
if (kArchVariant != kMips64r6) {
DCHECK_EQ(sa(), 0);
alu_out = get_register(HI);
} else {
// MIPS spec: If no bits were set in GPR rs(), the result written to
// GPR rd() is 32.
DCHECK_EQ(sa(), 1);
alu_out = base::bits::CountLeadingZeros32(static_cast<int32_t>(rs_u()));
}
SetResult(rd_reg(), alu_out);
break;
case MFLO: // MFLO == DCLZ on R6.
if (kArchVariant != kMips64r6) {
DCHECK_EQ(sa(), 0);
alu_out = get_register(LO);
} else {
// MIPS spec: If no bits were set in GPR rs(), the result written to
// GPR rd() is 64.
DCHECK_EQ(sa(), 1);
alu_out = base::bits::CountLeadingZeros64(static_cast<int64_t>(rs_u()));
}
SetResult(rd_reg(), alu_out);
break;
// Instructions using HI and LO registers.
case MULT: { // MULT == D_MUL_MUH.
int32_t rs_lo = static_cast<int32_t>(rs());
int32_t rt_lo = static_cast<int32_t>(rt());
i64hilo = static_cast<int64_t>(rs_lo) * static_cast<int64_t>(rt_lo);
if (kArchVariant != kMips64r6) {
set_register(LO, static_cast<int32_t>(i64hilo & 0xFFFFFFFF));
set_register(HI, static_cast<int32_t>(i64hilo >> 32));
} else {
switch (sa()) {
case MUL_OP:
SetResult(rd_reg(), static_cast<int32_t>(i64hilo & 0xFFFFFFFF));
break;
case MUH_OP:
SetResult(rd_reg(), static_cast<int32_t>(i64hilo >> 32));
break;
default:
UNIMPLEMENTED_MIPS();
break;
}
}
break;
}
case MULTU:
u64hilo = static_cast<uint64_t>(rs_u() & 0xFFFFFFFF) *
static_cast<uint64_t>(rt_u() & 0xFFFFFFFF);
if (kArchVariant != kMips64r6) {
set_register(LO, static_cast<int32_t>(u64hilo & 0xFFFFFFFF));
set_register(HI, static_cast<int32_t>(u64hilo >> 32));
} else {
switch (sa()) {
case MUL_OP:
SetResult(rd_reg(), static_cast<int32_t>(u64hilo & 0xFFFFFFFF));
break;
case MUH_OP:
SetResult(rd_reg(), static_cast<int32_t>(u64hilo >> 32));
break;
default:
UNIMPLEMENTED_MIPS();
break;
}
}
break;
case DMULT: // DMULT == D_MUL_MUH.
if (kArchVariant != kMips64r6) {
set_register(LO, rs() * rt());
set_register(HI, MultiplyHighSigned(rs(), rt()));
} else {
switch (sa()) {
case MUL_OP:
SetResult(rd_reg(), rs() * rt());
break;
case MUH_OP:
SetResult(rd_reg(), MultiplyHighSigned(rs(), rt()));
break;
default:
UNIMPLEMENTED_MIPS();
break;
}
}
break;
case DMULTU:
UNIMPLEMENTED_MIPS();
break;
case DIV:
case DDIV: {
const int64_t int_min_value =
instr_.FunctionFieldRaw() == DIV ? INT_MIN : LONG_MIN;
switch (kArchVariant) {
case kMips64r2:
// Divide by zero and overflow was not checked in the
// configuration step - div and divu do not raise exceptions. On
// division by 0 the result will be UNPREDICTABLE. On overflow
// (INT_MIN/-1), return INT_MIN which is what the hardware does.
if (rs() == int_min_value && rt() == -1) {
set_register(LO, int_min_value);
set_register(HI, 0);
} else if (rt() != 0) {
set_register(LO, rs() / rt());
set_register(HI, rs() % rt());
}
break;
case kMips64r6:
switch (sa()) {
case DIV_OP:
if (rs() == int_min_value && rt() == -1) {
SetResult(rd_reg(), int_min_value);
} else if (rt() != 0) {
SetResult(rd_reg(), rs() / rt());
}
break;
case MOD_OP:
if (rs() == int_min_value && rt() == -1) {
SetResult(rd_reg(), 0);
} else if (rt() != 0) {
SetResult(rd_reg(), rs() % rt());
}
break;
default:
UNIMPLEMENTED_MIPS();
break;
}
break;
default:
break;
}
break;
}
case DIVU:
switch (kArchVariant) {
case kMips64r6: {
uint32_t rt_u_32 = static_cast<uint32_t>(rt_u());
uint32_t rs_u_32 = static_cast<uint32_t>(rs_u());
switch (sa()) {
case DIV_OP:
if (rt_u_32 != 0) {
SetResult(rd_reg(), rs_u_32 / rt_u_32);
}
break;
case MOD_OP:
if (rt_u() != 0) {
SetResult(rd_reg(), rs_u_32 % rt_u_32);
}
break;
default:
UNIMPLEMENTED_MIPS();
break;
}
} break;
default: {
if (rt_u() != 0) {
uint32_t rt_u_32 = static_cast<uint32_t>(rt_u());
uint32_t rs_u_32 = static_cast<uint32_t>(rs_u());
set_register(LO, rs_u_32 / rt_u_32);
set_register(HI, rs_u_32 % rt_u_32);
}
}
}
break;
case DDIVU:
switch (kArchVariant) {
case kMips64r6: {
switch (instr_.SaValue()) {
case DIV_OP:
if (rt_u() != 0) {
SetResult(rd_reg(), rs_u() / rt_u());
}
break;
case MOD_OP:
if (rt_u() != 0) {
SetResult(rd_reg(), rs_u() % rt_u());
}
break;
default:
UNIMPLEMENTED_MIPS();
break;
}
} break;
default: {
if (rt_u() != 0) {
set_register(LO, rs_u() / rt_u());
set_register(HI, rs_u() % rt_u());
}
}
}
break;
case ADD:
case DADD:
if (HaveSameSign(rs(), rt())) {
if (rs() > 0) {
if (rs() > (Registers::kMaxValue - rt())) {
SignalException(kIntegerOverflow);
}
} else if (rs() < 0) {
if (rs() < (Registers::kMinValue - rt())) {
SignalException(kIntegerUnderflow);
}
}
}
SetResult(rd_reg(), rs() + rt());
break;
case ADDU: {
int32_t alu32_out = static_cast<int32_t>(rs() + rt());
// Sign-extend result of 32bit operation into 64bit register.
SetResult(rd_reg(), static_cast<int64_t>(alu32_out));
break;
}
case DADDU:
SetResult(rd_reg(), rs() + rt());
break;
case SUB:
case DSUB:
if (!HaveSameSign(rs(), rt())) {
if (rs() > 0) {
if (rs() > (Registers::kMaxValue + rt())) {
SignalException(kIntegerOverflow);
}
} else if (rs() < 0) {
if (rs() < (Registers::kMinValue + rt())) {
SignalException(kIntegerUnderflow);
}
}
}
SetResult(rd_reg(), rs() - rt());
break;
case SUBU: {
int32_t alu32_out = static_cast<int32_t>(rs() - rt());
// Sign-extend result of 32bit operation into 64bit register.
SetResult(rd_reg(), static_cast<int64_t>(alu32_out));
break;
}
case DSUBU:
SetResult(rd_reg(), rs() - rt());
break;
case AND:
SetResult(rd_reg(), rs() & rt());
break;
case OR:
SetResult(rd_reg(), rs() | rt());
break;
case XOR:
SetResult(rd_reg(), rs() ^ rt());
break;
case NOR:
SetResult(rd_reg(), ~(rs() | rt()));
break;
case SLT:
SetResult(rd_reg(), rs() < rt() ? 1 : 0);
break;
case SLTU:
SetResult(rd_reg(), rs_u() < rt_u() ? 1 : 0);
break;
// Break and trap instructions.
case BREAK:
do_interrupt = true;
break;
case TGE:
do_interrupt = rs() >= rt();
break;
case TGEU:
do_interrupt = rs_u() >= rt_u();
break;
case TLT:
do_interrupt = rs() < rt();
break;
case TLTU:
do_interrupt = rs_u() < rt_u();
break;
case TEQ:
do_interrupt = rs() == rt();
break;
case TNE:
do_interrupt = rs() != rt();
break;
case SYNC:
// TODO(palfia): Ignore sync instruction for now.
break;
// Conditional moves.
case MOVN:
if (rt()) {
SetResult(rd_reg(), rs());
}
break;
case MOVCI: {
uint32_t cc = instr_.FBccValue();
uint32_t fcsr_cc = get_fcsr_condition_bit(cc);
if (instr_.Bit(16)) { // Read Tf bit.
if (test_fcsr_bit(fcsr_cc)) SetResult(rd_reg(), rs());
} else {
if (!test_fcsr_bit(fcsr_cc)) SetResult(rd_reg(), rs());
}
break;
}
case MOVZ:
if (!rt()) {
SetResult(rd_reg(), rs());
}
break;
default:
UNREACHABLE();
}
if (do_interrupt) {
SoftwareInterrupt();
}
}
void Simulator::DecodeTypeRegisterSPECIAL2() {
int64_t alu_out;
switch (instr_.FunctionFieldRaw()) {
case MUL:
alu_out = static_cast<int32_t>(rs_u()) * static_cast<int32_t>(rt_u());
SetResult(rd_reg(), alu_out);
// HI and LO are UNPREDICTABLE after the operation.
set_register(LO, Unpredictable);
set_register(HI, Unpredictable);
break;
case CLZ:
// MIPS32 spec: If no bits were set in GPR rs(), the result written to
// GPR rd is 32.
alu_out = base::bits::CountLeadingZeros32(static_cast<uint32_t>(rs_u()));
SetResult(rd_reg(), alu_out);
break;
case DCLZ:
// MIPS64 spec: If no bits were set in GPR rs(), the result written to
// GPR rd is 64.
alu_out = base::bits::CountLeadingZeros64(static_cast<uint64_t>(rs_u()));
SetResult(rd_reg(), alu_out);
break;
default:
alu_out = 0x12345678;
UNREACHABLE();
}
}
void Simulator::DecodeTypeRegisterSPECIAL3() {
int64_t alu_out;
switch (instr_.FunctionFieldRaw()) {
case EXT: { // Mips32r2 instruction.
// Interpret rd field as 5-bit msbd of extract.
uint16_t msbd = rd_reg();
// Interpret sa field as 5-bit lsb of extract.
uint16_t lsb = sa();
uint16_t size = msbd + 1;
uint64_t mask = (1ULL << size) - 1;
alu_out = static_cast<int32_t>((rs_u() & (mask << lsb)) >> lsb);
SetResult(rt_reg(), alu_out);
break;
}
case DEXT: { // Mips64r2 instruction.
// Interpret rd field as 5-bit msbd of extract.
uint16_t msbd = rd_reg();
// Interpret sa field as 5-bit lsb of extract.
uint16_t lsb = sa();
uint16_t size = msbd + 1;
uint64_t mask = (size == 64) ? UINT64_MAX : (1ULL << size) - 1;
alu_out = static_cast<int64_t>((rs_u() & (mask << lsb)) >> lsb);
SetResult(rt_reg(), alu_out);
break;
}
case DEXTM: {
// Interpret rd field as 5-bit msbdminus32 of extract.
uint16_t msbdminus32 = rd_reg();
// Interpret sa field as 5-bit lsb of extract.
uint16_t lsb = sa();
uint16_t size = msbdminus32 + 1 + 32;
uint64_t mask = (size == 64) ? UINT64_MAX : (1ULL << size) - 1;
alu_out = static_cast<int64_t>((rs_u() & (mask << lsb)) >> lsb);
SetResult(rt_reg(), alu_out);
break;
}
case DEXTU: {
// Interpret rd field as 5-bit msbd of extract.
uint16_t msbd = rd_reg();
// Interpret sa field as 5-bit lsbminus32 of extract and add 32 to get
// lsb.
uint16_t lsb = sa() + 32;
uint16_t size = msbd + 1;
uint64_t mask = (size == 64) ? UINT64_MAX : (1ULL << size) - 1;
alu_out = static_cast<int64_t>((rs_u() & (mask << lsb)) >> lsb);
SetResult(rt_reg(), alu_out);
break;
}
case INS: { // Mips32r2 instruction.
// Interpret rd field as 5-bit msb of insert.
uint16_t msb = rd_reg();
// Interpret sa field as 5-bit lsb of insert.
uint16_t lsb = sa();
uint16_t size = msb - lsb + 1;
uint64_t mask = (1ULL << size) - 1;
alu_out = static_cast<int32_t>((rt_u() & ~(mask << lsb)) |
((rs_u() & mask) << lsb));
SetResult(rt_reg(), alu_out);
break;
}
case DINS: { // Mips64r2 instruction.
// Interpret rd field as 5-bit msb of insert.
uint16_t msb = rd_reg();
// Interpret sa field as 5-bit lsb of insert.
uint16_t lsb = sa();
uint16_t size = msb - lsb + 1;
uint64_t mask = (1ULL << size) - 1;
alu_out = (rt_u() & ~(mask << lsb)) | ((rs_u() & mask) << lsb);
SetResult(rt_reg(), alu_out);
break;
}
case DINSM: { // Mips64r2 instruction.
// Interpret rd field as 5-bit msbminus32 of insert.
uint16_t msbminus32 = rd_reg();
// Interpret sa field as 5-bit lsb of insert.
uint16_t lsb = sa();
uint16_t size = msbminus32 + 32 - lsb + 1;
uint64_t mask;
if (size < 64)
mask = (1ULL << size) - 1;
else
mask = std::numeric_limits<uint64_t>::max();
alu_out = (rt_u() & ~(mask << lsb)) | ((rs_u() & mask) << lsb);
SetResult(rt_reg(), alu_out);
break;
}
case DINSU: { // Mips64r2 instruction.
// Interpret rd field as 5-bit msbminus32 of insert.
uint16_t msbminus32 = rd_reg();
// Interpret rd field as 5-bit lsbminus32 of insert.
uint16_t lsbminus32 = sa();
uint16_t lsb = lsbminus32 + 32;
uint16_t size = msbminus32 + 32 - lsb + 1;
uint64_t mask = (1ULL << size) - 1;
alu_out = (rt_u() & ~(mask << lsb)) | ((rs_u() & mask) << lsb);
SetResult(rt_reg(), alu_out);
break;
}
case BSHFL: {
int32_t sa = instr_.SaFieldRaw() >> kSaShift;
switch (sa) {
case BITSWAP: {
uint32_t input = static_cast<uint32_t>(rt());
uint32_t output = 0;
uint8_t i_byte, o_byte;
// Reverse the bit in byte for each individual byte
for (int i = 0; i < 4; i++) {
output = output >> 8;
i_byte = input & 0xFF;
// Fast way to reverse bits in byte
// Devised by Sean Anderson, July 13, 2001
o_byte = static_cast<uint8_t>(((i_byte * 0x0802LU & 0x22110LU) |
(i_byte * 0x8020LU & 0x88440LU)) *
0x10101LU >>
16);
output = output | (static_cast<uint32_t>(o_byte << 24));
input = input >> 8;
}
alu_out = static_cast<int64_t>(static_cast<int32_t>(output));
break;
}
case SEB: {
uint8_t input = static_cast<uint8_t>(rt());
uint32_t output = input;
uint32_t mask = 0x00000080;
// Extending sign
if (mask & input) {
output |= 0xFFFFFF00;
}
alu_out = static_cast<int32_t>(output);
break;
}
case SEH: {
uint16_t input = static_cast<uint16_t>(rt());
uint32_t output = input;
uint32_t mask = 0x00008000;
// Extending sign
if (mask & input) {
output |= 0xFFFF0000;
}
alu_out = static_cast<int32_t>(output);
break;
}
case WSBH: {
uint32_t input = static_cast<uint32_t>(rt());
uint64_t output = 0;
uint32_t mask = 0xFF000000;
for (int i = 0; i < 4; i++) {
uint32_t tmp = mask & input;
if (i % 2 == 0) {
tmp = tmp >> 8;
} else {
tmp = tmp << 8;
}
output = output | tmp;
mask = mask >> 8;
}
mask = 0x80000000;
// Extending sign
if (mask & output) {
output |= 0xFFFFFFFF00000000;
}
alu_out = static_cast<int64_t>(output);
break;
}
default: {
const uint8_t bp2 = instr_.Bp2Value();
sa >>= kBp2Bits;
switch (sa) {
case ALIGN: {
if (bp2 == 0) {
alu_out = static_cast<int32_t>(rt());
} else {
uint64_t rt_hi = rt() << (8 * bp2);
uint64_t rs_lo = rs() >> (8 * (4 - bp2));
alu_out = static_cast<int32_t>(rt_hi | rs_lo);
}
break;
}
default:
alu_out = 0x12345678;
UNREACHABLE();
break;
}
break;
}
}
SetResult(rd_reg(), alu_out);
break;
}
case DBSHFL: {
int32_t sa = instr_.SaFieldRaw() >> kSaShift;
switch (sa) {
case DBITSWAP: {
switch (sa) {
case DBITSWAP_SA: { // Mips64r6
uint64_t input = static_cast<uint64_t>(rt());
uint64_t output = 0;
uint8_t i_byte, o_byte;
// Reverse the bit in byte for each individual byte
for (int i = 0; i < 8; i++) {
output = output >> 8;
i_byte = input & 0xFF;
// Fast way to reverse bits in byte
// Devised by Sean Anderson, July 13, 2001
o_byte =
static_cast<uint8_t>(((i_byte * 0x0802LU & 0x22110LU) |
(i_byte * 0x8020LU & 0x88440LU)) *
0x10101LU >>
16);
output = output | ((static_cast<uint64_t>(o_byte) << 56));
input = input >> 8;
}
alu_out = static_cast<int64_t>(output);
break;
}
}
break;
}
case DSBH: {
uint64_t input = static_cast<uint64_t>(rt());
uint64_t output = 0;
uint64_t mask = 0xFF00000000000000;
for (int i = 0; i < 8; i++) {
uint64_t tmp = mask & input;
if (i % 2 == 0)
tmp = tmp >> 8;
else
tmp = tmp << 8;
output = output | tmp;
mask = mask >> 8;
}
alu_out = static_cast<int64_t>(output);
break;
}
case DSHD: {
uint64_t input = static_cast<uint64_t>(rt());
uint64_t output = 0;
uint64_t mask = 0xFFFF000000000000;
for (int i = 0; i < 4; i++) {
uint64_t tmp = mask & input;
if (i == 0)
tmp = tmp >> 48;
else if (i == 1)
tmp = tmp >> 16;
else if (i == 2)
tmp = tmp << 16;
else
tmp = tmp << 48;
output = output | tmp;
mask = mask >> 16;
}
alu_out = static_cast<int64_t>(output);
break;
}
default: {
const uint8_t bp3 = instr_.Bp3Value();
sa >>= kBp3Bits;
switch (sa) {
case DALIGN: {
if (bp3 == 0) {
alu_out = static_cast<int64_t>(rt());
} else {
uint64_t rt_hi = rt() << (8 * bp3);
uint64_t rs_lo = rs() >> (8 * (8 - bp3));
alu_out = static_cast<int64_t>(rt_hi | rs_lo);
}
break;
}
default:
alu_out = 0x12345678;
UNREACHABLE();
break;
}
break;
}
}
SetResult(rd_reg(), alu_out);
break;
}
default:
UNREACHABLE();
}
}
int Simulator::DecodeMsaDataFormat() {
int df = -1;
if (instr_.IsMSABranchInstr()) {
switch (instr_.RsFieldRaw()) {
case BZ_V:
case BNZ_V:
df = MSA_VECT;
break;
case BZ_B:
case BNZ_B:
df = MSA_BYTE;
break;
case BZ_H:
case BNZ_H:
df = MSA_HALF;
break;
case BZ_W:
case BNZ_W:
df = MSA_WORD;
break;
case BZ_D:
case BNZ_D:
df = MSA_DWORD;
break;
default:
UNREACHABLE();
break;
}
} else {
int DF[] = {MSA_BYTE, MSA_HALF, MSA_WORD, MSA_DWORD};
switch (instr_.MSAMinorOpcodeField()) {
case kMsaMinorI5:
case kMsaMinorI10:
case kMsaMinor3R:
df = DF[instr_.Bits(22, 21)];
break;
case kMsaMinorMI10:
df = DF[instr_.Bits(1, 0)];
break;
case kMsaMinorBIT:
df = DF[instr_.MsaBitDf()];
break;
case kMsaMinorELM:
df = DF[instr_.MsaElmDf()];
break;
case kMsaMinor3RF: {
uint32_t opcode = instr_.InstructionBits() & kMsa3RFMask;
switch (opcode) {
case FEXDO:
case FTQ:
case MUL_Q:
case MADD_Q:
case MSUB_Q:
case MULR_Q:
case MADDR_Q:
case MSUBR_Q:
df = DF[1 + instr_.Bit(21)];
break;
default:
df = DF[2 + instr_.Bit(21)];
break;
}
} break;
case kMsaMinor2R:
df = DF[instr_.Bits(17, 16)];
break;
case kMsaMinor2RF:
df = DF[2 + instr_.Bit(16)];
break;
default:
UNREACHABLE();
break;
}
}
return df;
}
void Simulator::DecodeTypeMsaI8() {
DCHECK_EQ(kArchVariant, kMips64r6);
DCHECK(CpuFeatures::IsSupported(MIPS_SIMD));
uint32_t opcode = instr_.InstructionBits() & kMsaI8Mask;
int8_t i8 = instr_.MsaImm8Value();
msa_reg_t ws, wd;
switch (opcode) {
case ANDI_B:
get_msa_register(instr_.WsValue(), ws.b);
for (int i = 0; i < kMSALanesByte; i++) {
wd.b[i] = ws.b[i] & i8;
}
set_msa_register(instr_.WdValue(), wd.b);
TraceMSARegWr(wd.b);
break;
case ORI_B:
get_msa_register(instr_.WsValue(), ws.b);
for (int i = 0; i < kMSALanesByte; i++) {
wd.b[i] = ws.b[i] | i8;
}
set_msa_register(instr_.WdValue(), wd.b);
TraceMSARegWr(wd.b);
break;
case NORI_B:
get_msa_register(instr_.WsValue(), ws.b);
for (int i = 0; i < kMSALanesByte; i++) {
wd.b[i] = ~(ws.b[i] | i8);
}
set_msa_register(instr_.WdValue(), wd.b);
TraceMSARegWr(wd.b);
break;
case XORI_B:
get_msa_register(instr_.WsValue(), ws.b);
for (int i = 0; i < kMSALanesByte; i++) {
wd.b[i] = ws.b[i] ^ i8;
}
set_msa_register(instr_.WdValue(), wd.b);
TraceMSARegWr(wd.b);
break;
case BMNZI_B:
get_msa_register(instr_.WsValue(), ws.b);
get_msa_register(instr_.WdValue(), wd.b);
for (int i = 0; i < kMSALanesByte; i++) {
wd.b[i] = (ws.b[i] & i8) | (wd.b[i] & ~i8);
}
set_msa_register(instr_.WdValue(), wd.b);
TraceMSARegWr(wd.b);
break;
case BMZI_B:
get_msa_register(instr_.WsValue(), ws.b);
get_msa_register(instr_.WdValue(), wd.b);
for (int i = 0; i < kMSALanesByte; i++) {
wd.b[i] = (ws.b[i] & ~i8) | (wd.b[i] & i8);
}
set_msa_register(instr_.WdValue(), wd.b);
TraceMSARegWr(wd.b);
break;
case BSELI_B:
get_msa_register(instr_.WsValue(), ws.b);
get_msa_register(instr_.WdValue(), wd.b);
for (int i = 0; i < kMSALanesByte; i++) {
wd.b[i] = (ws.b[i] & ~wd.b[i]) | (wd.b[i] & i8);
}
set_msa_register(instr_.WdValue(), wd.b);
TraceMSARegWr(wd.b);
break;
case SHF_B:
get_msa_register(instr_.WsValue(), ws.b);
for (int i = 0; i < kMSALanesByte; i++) {
int j = i % 4;
int k = (i8 >> (2 * j)) & 0x3;
wd.b[i] = ws.b[i - j + k];
}
set_msa_register(instr_.WdValue(), wd.b);
TraceMSARegWr(wd.b);
break;
case SHF_H:
get_msa_register(instr_.WsValue(), ws.h);
for (int i = 0; i < kMSALanesHalf; i++) {
int j = i % 4;
int k = (i8 >> (2 * j)) & 0x3;
wd.h[i] = ws.h[i - j + k];
}
set_msa_register(instr_.WdValue(), wd.h);
TraceMSARegWr(wd.h);
break;
case SHF_W:
get_msa_register(instr_.WsValue(), ws.w);
for (int i = 0; i < kMSALanesWord; i++) {
int j = (i8 >> (2 * i)) & 0x3;
wd.w[i] = ws.w[j];
}
set_msa_register(instr_.WdValue(), wd.w);
TraceMSARegWr(wd.w);
break;
default:
UNREACHABLE();
}
}
template <typename T>
T Simulator::MsaI5InstrHelper(uint32_t opcode, T ws, int32_t i5) {
T res;
uint32_t ui5 = i5 & 0x1Fu;
uint64_t ws_u64 = static_cast<uint64_t>(ws);
uint64_t ui5_u64 = static_cast<uint64_t>(ui5);
switch (opcode) {
case ADDVI:
res = static_cast<T>(ws + ui5);
break;
case SUBVI:
res = static_cast<T>(ws - ui5);
break;
case MAXI_S:
res = static_cast<T>(Max(ws, static_cast<T>(i5)));
break;
case MINI_S:
res = static_cast<T>(Min(ws, static_cast<T>(i5)));
break;
case MAXI_U:
res = static_cast<T>(Max(ws_u64, ui5_u64));
break;
case MINI_U:
res = static_cast<T>(Min(ws_u64, ui5_u64));
break;
case CEQI:
res = static_cast<T>(!Compare(ws, static_cast<T>(i5)) ? -1ull : 0ull);
break;
case CLTI_S:
res = static_cast<T>((Compare(ws, static_cast<T>(i5)) == -1) ? -1ull
: 0ull);
break;
case CLTI_U:
res = static_cast<T>((Compare(ws_u64, ui5_u64) == -1) ? -1ull : 0ull);
break;
case CLEI_S:
res =
static_cast<T>((Compare(ws, static_cast<T>(i5)) != 1) ? -1ull : 0ull);
break;
case CLEI_U:
res = static_cast<T>((Compare(ws_u64, ui5_u64) != 1) ? -1ull : 0ull);
break;
default:
UNREACHABLE();
}
return res;
}
void Simulator::DecodeTypeMsaI5() {
DCHECK_EQ(kArchVariant, kMips64r6);
DCHECK(CpuFeatures::IsSupported(MIPS_SIMD));
uint32_t opcode = instr_.InstructionBits() & kMsaI5Mask;
msa_reg_t ws, wd;
// sign extend 5bit value to int32_t
int32_t i5 = static_cast<int32_t>(instr_.MsaImm5Value() << 27) >> 27;
#define MSA_I5_DF(elem, num_of_lanes) \
get_msa_register(instr_.WsValue(), ws.elem); \
for (int i = 0; i < num_of_lanes; i++) { \
wd.elem[i] = MsaI5InstrHelper(opcode, ws.elem[i], i5); \
} \
set_msa_register(instr_.WdValue(), wd.elem); \
TraceMSARegWr(wd.elem)
switch (DecodeMsaDataFormat()) {
case MSA_BYTE:
MSA_I5_DF(b, kMSALanesByte);
break;
case MSA_HALF:
MSA_I5_DF(h, kMSALanesHalf);
break;
case MSA_WORD:
MSA_I5_DF(w, kMSALanesWord);
break;
case MSA_DWORD:
MSA_I5_DF(d, kMSALanesDword);
break;
default:
UNREACHABLE();
}
#undef MSA_I5_DF
}
void Simulator::DecodeTypeMsaI10() {
DCHECK_EQ(kArchVariant, kMips64r6);
DCHECK(CpuFeatures::IsSupported(MIPS_SIMD));
uint32_t opcode = instr_.InstructionBits() & kMsaI5Mask;
int64_t s10 = (static_cast<int64_t>(instr_.MsaImm10Value()) << 54) >> 54;
msa_reg_t wd;
#define MSA_I10_DF(elem, num_of_lanes, T) \
for (int i = 0; i < num_of_lanes; ++i) { \
wd.elem[i] = static_cast<T>(s10); \
} \
set_msa_register(instr_.WdValue(), wd.elem); \
TraceMSARegWr(wd.elem)
if (opcode == LDI) {
switch (DecodeMsaDataFormat()) {
case MSA_BYTE:
MSA_I10_DF(b, kMSALanesByte, int8_t);
break;
case MSA_HALF:
MSA_I10_DF(h, kMSALanesHalf, int16_t);
break;
case MSA_WORD:
MSA_I10_DF(w, kMSALanesWord, int32_t);
break;
case MSA_DWORD:
MSA_I10_DF(d, kMSALanesDword, int64_t);
break;
default:
UNREACHABLE();
}
} else {
UNREACHABLE();
}
#undef MSA_I10_DF
}
void Simulator::DecodeTypeMsaELM() {
DCHECK_EQ(kArchVariant, kMips64r6);
DCHECK(CpuFeatures::IsSupported(MIPS_SIMD));
uint32_t opcode = instr_.InstructionBits() & kMsaLongerELMMask;
int32_t n = instr_.MsaElmNValue();
int64_t alu_out;
switch (opcode) {
case CTCMSA:
DCHECK_EQ(sa(), kMSACSRRegister);
MSACSR_ = bit_cast<uint32_t>(
static_cast<int32_t>(registers_[rd_reg()] & kMaxUInt32));
TraceRegWr(static_cast<int32_t>(MSACSR_));
break;
case CFCMSA:
DCHECK_EQ(rd_reg(), kMSACSRRegister);
SetResult(sa(), static_cast<int64_t>(bit_cast<int32_t>(MSACSR_)));
break;
case MOVE_V: {
msa_reg_t ws;
get_msa_register(ws_reg(), &ws);
set_msa_register(wd_reg(), &ws);
TraceMSARegWr(&ws);
} break;
default:
opcode &= kMsaELMMask;
switch (opcode) {
case COPY_S:
case COPY_U: {
msa_reg_t ws;
switch (DecodeMsaDataFormat()) {
case MSA_BYTE:
DCHECK_LT(n, kMSALanesByte);
get_msa_register(instr_.WsValue(), ws.b);
alu_out = static_cast<int32_t>(ws.b[n]);
SetResult(wd_reg(),
(opcode == COPY_U) ? alu_out & 0xFFu : alu_out);
break;
case MSA_HALF:
DCHECK_LT(n, kMSALanesHalf);
get_msa_register(instr_.WsValue(), ws.h);
alu_out = static_cast<int32_t>(ws.h[n]);
SetResult(wd_reg(),
(opcode == COPY_U) ? alu_out & 0xFFFFu : alu_out);
break;
case MSA_WORD:
DCHECK_LT(n, kMSALanesWord);
get_msa_register(instr_.WsValue(), ws.w);
alu_out = static_cast<int32_t>(ws.w[n]);
SetResult(wd_reg(),
(opcode == COPY_U) ? alu_out & 0xFFFFFFFFu : alu_out);
break;
case MSA_DWORD:
DCHECK_LT(n, kMSALanesDword);
get_msa_register(instr_.WsValue(), ws.d);
alu_out = static_cast<int64_t>(ws.d[n]);
SetResult(wd_reg(), alu_out);
break;
default:
UNREACHABLE();
}
} break;
case INSERT: {
msa_reg_t wd;
switch (DecodeMsaDataFormat()) {
case MSA_BYTE: {
DCHECK_LT(n, kMSALanesByte);
int64_t rs = get_register(instr_.WsValue());
get_msa_register(instr_.WdValue(), wd.b);
wd.b[n] = rs & 0xFFu;
set_msa_register(instr_.WdValue(), wd.b);
TraceMSARegWr(wd.b);
break;
}
case MSA_HALF: {
DCHECK_LT(n, kMSALanesHalf);
int64_t rs = get_register(instr_.WsValue());
get_msa_register(instr_.WdValue(), wd.h);
wd.h[n] = rs & 0xFFFFu;
set_msa_register(instr_.WdValue(), wd.h);
TraceMSARegWr(wd.h);
break;
}
case MSA_WORD: {
DCHECK_LT(n, kMSALanesWord);
int64_t rs = get_register(instr_.WsValue());
get_msa_register(instr_.WdValue(), wd.w);
wd.w[n] = rs & 0xFFFFFFFFu;
set_msa_register(instr_.WdValue(), wd.w);
TraceMSARegWr(wd.w);
break;
}
case MSA_DWORD: {
DCHECK_LT(n, kMSALanesDword);
int64_t rs = get_register(instr_.WsValue());
get_msa_register(instr_.WdValue(), wd.d);
wd.d[n] = rs;
set_msa_register(instr_.WdValue(), wd.d);
TraceMSARegWr(wd.d);
break;
}
default:
UNREACHABLE();
}
} break;
case SLDI: {
uint8_t v[32];
msa_reg_t ws;
msa_reg_t wd;
get_msa_register(ws_reg(), &ws);
get_msa_register(wd_reg(), &wd);
#define SLDI_DF(s, k) \
for (unsigned i = 0; i < s; i++) { \
v[i] = ws.b[s * k + i]; \
v[i + s] = wd.b[s * k + i]; \
} \
for (unsigned i = 0; i < s; i++) { \
wd.b[s * k + i] = v[i + n]; \
}
switch (DecodeMsaDataFormat()) {
case MSA_BYTE:
DCHECK(n < kMSALanesByte);
SLDI_DF(kMSARegSize / sizeof(int8_t) / kBitsPerByte, 0)
break;
case MSA_HALF:
DCHECK(n < kMSALanesHalf);
for (int k = 0; k < 2; ++k) {
SLDI_DF(kMSARegSize / sizeof(int16_t) / kBitsPerByte, k)
}
break;
case MSA_WORD:
DCHECK(n < kMSALanesWord);
for (int k = 0; k < 4; ++k) {
SLDI_DF(kMSARegSize / sizeof(int32_t) / kBitsPerByte, k)
}
break;
case MSA_DWORD:
DCHECK(n < kMSALanesDword);
for (int k = 0; k < 8; ++k) {
SLDI_DF(kMSARegSize / sizeof(int64_t) / kBitsPerByte, k)
}
break;
default:
UNREACHABLE();
}
set_msa_register(wd_reg(), &wd);
TraceMSARegWr(&wd);
} break;
#undef SLDI_DF
case SPLATI:
case INSVE:
UNIMPLEMENTED();
break;
default:
UNREACHABLE();
}
break;
}
}
template <typename T>
T Simulator::MsaBitInstrHelper(uint32_t opcode, T wd, T ws, int32_t m) {
using uT = typename std::make_unsigned<T>::type;
T res;
switch (opcode) {
case SLLI:
res = static_cast<T>(ws << m);
break;
case SRAI:
res = static_cast<T>(ArithmeticShiftRight(ws, m));
break;
case SRLI:
res = static_cast<T>(static_cast<uT>(ws) >> m);
break;
case BCLRI:
res = static_cast<T>(static_cast<T>(~(1ull << m)) & ws);
break;
case BSETI:
res = static_cast<T>(static_cast<T>(1ull << m) | ws);
break;
case BNEGI:
res = static_cast<T>(static_cast<T>(1ull << m) ^ ws);
break;
case BINSLI: {
int elem_size = 8 * sizeof(T);
int bits = m + 1;
if (bits == elem_size) {
res = static_cast<T>(ws);
} else {
uint64_t mask = ((1ull << bits) - 1) << (elem_size - bits);
res = static_cast<T>((static_cast<T>(mask) & ws) |
(static_cast<T>(~mask) & wd));
}
} break;
case BINSRI: {
int elem_size = 8 * sizeof(T);
int bits = m + 1;
if (bits == elem_size) {
res = static_cast<T>(ws);
} else {
uint64_t mask = (1ull << bits) - 1;
res = static_cast<T>((static_cast<T>(mask) & ws) |
(static_cast<T>(~mask) & wd));
}
} break;
case SAT_S: {
#define M_MAX_INT(x) static_cast<int64_t>((1LL << ((x)-1)) - 1)
#define M_MIN_INT(x) static_cast<int64_t>(-(1LL << ((x)-1)))
int shift = 64 - 8 * sizeof(T);
int64_t ws_i64 = (static_cast<int64_t>(ws) << shift) >> shift;
res = static_cast<T>(ws_i64 < M_MIN_INT(m + 1)
? M_MIN_INT(m + 1)
: ws_i64 > M_MAX_INT(m + 1) ? M_MAX_INT(m + 1)
: ws_i64);
#undef M_MAX_INT
#undef M_MIN_INT
} break;
case SAT_U: {
#define M_MAX_UINT(x) static_cast<uint64_t>(-1ULL >> (64 - (x)))
uint64_t mask = static_cast<uint64_t>(-1ULL >> (64 - 8 * sizeof(T)));
uint64_t ws_u64 = static_cast<uint64_t>(ws) & mask;
res = static_cast<T>(ws_u64 < M_MAX_UINT(m + 1) ? ws_u64
: M_MAX_UINT(m + 1));
#undef M_MAX_UINT
} break;
case SRARI:
if (!m) {
res = static_cast<T>(ws);
} else {
res = static_cast<T>(ArithmeticShiftRight(ws, m)) +
static_cast<T>((ws >> (m - 1)) & 0x1);
}
break;
case SRLRI:
if (!m) {
res = static_cast<T>(ws);
} else {
res = static_cast<T>(static_cast<uT>(ws) >> m) +
static_cast<T>((ws >> (m - 1)) & 0x1);
}
break;
default:
UNREACHABLE();
}
return res;
}
void Simulator::DecodeTypeMsaBIT() {
DCHECK_EQ(kArchVariant, kMips64r6);
DCHECK(CpuFeatures::IsSupported(MIPS_SIMD));
uint32_t opcode = instr_.InstructionBits() & kMsaBITMask;
int32_t m = instr_.MsaBitMValue();
msa_reg_t wd, ws;
#define MSA_BIT_DF(elem, num_of_lanes) \
get_msa_register(instr_.WsValue(), ws.elem); \
if (opcode == BINSLI || opcode == BINSRI) { \
get_msa_register(instr_.WdValue(), wd.elem); \
} \
for (int i = 0; i < num_of_lanes; i++) { \
wd.elem[i] = MsaBitInstrHelper(opcode, wd.elem[i], ws.elem[i], m); \
} \
set_msa_register(instr_.WdValue(), wd.elem); \
TraceMSARegWr(wd.elem)
switch (DecodeMsaDataFormat()) {
case MSA_BYTE:
DCHECK(m < kMSARegSize / kMSALanesByte);
MSA_BIT_DF(b, kMSALanesByte);
break;
case MSA_HALF:
DCHECK(m < kMSARegSize / kMSALanesHalf);
MSA_BIT_DF(h, kMSALanesHalf);
break;
case MSA_WORD:
DCHECK(m < kMSARegSize / kMSALanesWord);
MSA_BIT_DF(w, kMSALanesWord);
break;
case MSA_DWORD:
DCHECK(m < kMSARegSize / kMSALanesDword);
MSA_BIT_DF(d, kMSALanesDword);
break;
default:
UNREACHABLE();
}
#undef MSA_BIT_DF
}
void Simulator::DecodeTypeMsaMI10() {
DCHECK_EQ(kArchVariant, kMips64r6);
DCHECK(CpuFeatures::IsSupported(MIPS_SIMD));
uint32_t opcode = instr_.InstructionBits() & kMsaMI10Mask;
int64_t s10 = (static_cast<int64_t>(instr_.MsaImmMI10Value()) << 54) >> 54;
int64_t rs = get_register(instr_.WsValue());
int64_t addr;
msa_reg_t wd;
#define MSA_MI10_LOAD(elem, num_of_lanes, T) \
for (int i = 0; i < num_of_lanes; ++i) { \
addr = rs + (s10 + i) * sizeof(T); \
wd.elem[i] = ReadMem<T>(addr, instr_.instr()); \
} \
set_msa_register(instr_.WdValue(), wd.elem);
#define MSA_MI10_STORE(elem, num_of_lanes, T) \
get_msa_register(instr_.WdValue(), wd.elem); \
for (int i = 0; i < num_of_lanes; ++i) { \
addr = rs + (s10 + i) * sizeof(T); \
WriteMem<T>(addr, wd.elem[i], instr_.instr()); \
}
if (opcode == MSA_LD) {
switch (DecodeMsaDataFormat()) {
case MSA_BYTE:
MSA_MI10_LOAD(b, kMSALanesByte, int8_t);
break;
case MSA_HALF:
MSA_MI10_LOAD(h, kMSALanesHalf, int16_t);
break;
case MSA_WORD:
MSA_MI10_LOAD(w, kMSALanesWord, int32_t);
break;
case MSA_DWORD:
MSA_MI10_LOAD(d, kMSALanesDword, int64_t);
break;
default:
UNREACHABLE();
}
} else if (opcode == MSA_ST) {
switch (DecodeMsaDataFormat()) {
case MSA_BYTE:
MSA_MI10_STORE(b, kMSALanesByte, int8_t);
break;
case MSA_HALF:
MSA_MI10_STORE(h, kMSALanesHalf, int16_t);
break;
case MSA_WORD:
MSA_MI10_STORE(w, kMSALanesWord, int32_t);
break;
case MSA_DWORD:
MSA_MI10_STORE(d, kMSALanesDword, int64_t);
break;
default:
UNREACHABLE();
}
} else {
UNREACHABLE();
}
#undef MSA_MI10_LOAD
#undef MSA_MI10_STORE
}
template <typename T>
T Simulator::Msa3RInstrHelper(uint32_t opcode, T wd, T ws, T wt) {
using uT = typename std::make_unsigned<T>::type;
T res;
int wt_modulo = wt % (sizeof(T) * 8);
switch (opcode) {
case SLL_MSA:
res = static_cast<T>(ws << wt_modulo);
break;
case SRA_MSA:
res = static_cast<T>(ArithmeticShiftRight(ws, wt_modulo));
break;
case SRL_MSA:
res = static_cast<T>(static_cast<uT>(ws) >> wt_modulo);
break;
case BCLR:
res = static_cast<T>(static_cast<T>(~(1ull << wt_modulo)) & ws);
break;
case BSET:
res = static_cast<T>(static_cast<T>(1ull << wt_modulo) | ws);
break;
case BNEG:
res = static_cast<T>(static_cast<T>(1ull << wt_modulo) ^ ws);
break;
case BINSL: {
int elem_size = 8 * sizeof(T);
int bits = wt_modulo + 1;
if (bits == elem_size) {
res = static_cast<T>(ws);
} else {
uint64_t mask = ((1ull << bits) - 1) << (elem_size - bits);
res = static_cast<T>((static_cast<T>(mask) & ws) |
(static_cast<T>(~mask) & wd));
}
} break;
case BINSR: {
int elem_size = 8 * sizeof(T);
int bits = wt_modulo + 1;
if (bits == elem_size) {
res = static_cast<T>(ws);
} else {
uint64_t mask = (1ull << bits) - 1;
res = static_cast<T>((static_cast<T>(mask) & ws) |
(static_cast<T>(~mask) & wd));
}
} break;
case ADDV:
res = ws + wt;
break;
case SUBV:
res = ws - wt;
break;
case MAX_S:
res = Max(ws, wt);
break;
case MAX_U:
res = static_cast<T>(Max(static_cast<uT>(ws), static_cast<uT>(wt)));
break;
case MIN_S:
res = Min(ws, wt);
break;
case MIN_U:
res = static_cast<T>(Min(static_cast<uT>(ws), static_cast<uT>(wt)));
break;
case MAX_A:
// We use negative abs in order to avoid problems
// with corner case for MIN_INT
res = Nabs(ws) < Nabs(wt) ? ws : wt;
break;
case MIN_A:
// We use negative abs in order to avoid problems
// with corner case for MIN_INT
res = Nabs(ws) > Nabs(wt) ? ws : wt;
break;
case CEQ:
res = static_cast<T>(!Compare(ws, wt) ? -1ull : 0ull);
break;
case CLT_S:
res = static_cast<T>((Compare(ws, wt) == -1) ? -1ull : 0ull);
break;
case CLT_U:
res = static_cast<T>(
(Compare(static_cast<uT>(ws), static_cast<uT>(wt)) == -1) ? -1ull
: 0ull);
break;
case CLE_S:
res = static_cast<T>((Compare(ws, wt) != 1) ? -1ull : 0ull);
break;
case CLE_U:
res = static_cast<T>(
(Compare(static_cast<uT>(ws), static_cast<uT>(wt)) != 1) ? -1ull
: 0ull);
break;
case ADD_A:
res = static_cast<T>(Abs(ws) + Abs(wt));
break;
case ADDS_A: {
T ws_nabs = Nabs(ws);
T wt_nabs = Nabs(wt);
if (ws_nabs < -std::numeric_limits<T>::max() - wt_nabs) {
res = std::numeric_limits<T>::max();
} else {
res = -(ws_nabs + wt_nabs);
}
} break;
case ADDS_S:
res = SaturateAdd(ws, wt);
break;
case ADDS_U: {
uT ws_u = static_cast<uT>(ws);
uT wt_u = static_cast<uT>(wt);
res = static_cast<T>(SaturateAdd(ws_u, wt_u));
} break;
case AVE_S:
res = static_cast<T>((wt & ws) + ((wt ^ ws) >> 1));
break;
case AVE_U: {
uT ws_u = static_cast<uT>(ws);
uT wt_u = static_cast<uT>(wt);
res = static_cast<T>((wt_u & ws_u) + ((wt_u ^ ws_u) >> 1));
} break;
case AVER_S:
res = static_cast<T>((wt | ws) - ((wt ^ ws) >> 1));
break;
case AVER_U: {
uT ws_u = static_cast<uT>(ws);
uT wt_u = static_cast<uT>(wt);
res = static_cast<T>((wt_u | ws_u) - ((wt_u ^ ws_u) >> 1));
} break;
case SUBS_S:
res = SaturateSub(ws, wt);
break;
case SUBS_U: {
uT ws_u = static_cast<uT>(ws);
uT wt_u = static_cast<uT>(wt);
res = static_cast<T>(SaturateSub(ws_u, wt_u));
} break;
case SUBSUS_U: {
uT wsu = static_cast<uT>(ws);
if (wt > 0) {
uT wtu = static_cast<uT>(wt);
if (wtu > wsu) {
res = 0;
} else {
res = static_cast<T>(wsu - wtu);
}
} else {
if (wsu > std::numeric_limits<uT>::max() + wt) {
res = static_cast<T>(std::numeric_limits<uT>::max());
} else {
res = static_cast<T>(wsu - wt);
}
}
} break;
case SUBSUU_S: {
uT wsu = static_cast<uT>(ws);
uT wtu = static_cast<uT>(wt);
uT wdu;
if (wsu > wtu) {
wdu = wsu - wtu;
if (wdu > std::numeric_limits<T>::max()) {
res = std::numeric_limits<T>::max();
} else {
res = static_cast<T>(wdu);
}
} else {
wdu = wtu - wsu;
CHECK(-std::numeric_limits<T>::max() ==
std::numeric_limits<T>::min() + 1);
if (wdu <= std::numeric_limits<T>::max()) {
res = -static_cast<T>(wdu);
} else {
res = std::numeric_limits<T>::min();
}
}
} break;
case ASUB_S:
res = static_cast<T>(Abs(ws - wt));
break;
case ASUB_U: {
uT wsu = static_cast<uT>(ws);
uT wtu = static_cast<uT>(wt);
res = static_cast<T>(wsu > wtu ? wsu - wtu : wtu - wsu);
} break;
case MULV:
res = ws * wt;
break;
case MADDV:
res = wd + ws * wt;
break;
case MSUBV:
res = wd - ws * wt;
break;
case DIV_S_MSA:
res = wt != 0 ? ws / wt : static_cast<T>(Unpredictable);
break;
case DIV_U:
res = wt != 0 ? static_cast<T>(static_cast<uT>(ws) / static_cast<uT>(wt))
: static_cast<T>(Unpredictable);
break;
case MOD_S:
res = wt != 0 ? ws % wt : static_cast<T>(Unpredictable);
break;
case MOD_U:
res = wt != 0 ? static_cast<T>(static_cast<uT>(ws) % static_cast<uT>(wt))
: static_cast<T>(Unpredictable);
break;
case DOTP_S:
case DOTP_U:
case DPADD_S:
case DPADD_U:
case DPSUB_S:
case DPSUB_U:
case SLD:
case SPLAT:
UNIMPLEMENTED();
break;
case SRAR: {
int bit = wt_modulo == 0 ? 0 : (ws >> (wt_modulo - 1)) & 1;
res = static_cast<T>(ArithmeticShiftRight(ws, wt_modulo) + bit);
} break;
case SRLR: {
uT wsu = static_cast<uT>(ws);
int bit = wt_modulo == 0 ? 0 : (wsu >> (wt_modulo - 1)) & 1;
res = static_cast<T>((wsu >> wt_modulo) + bit);
} break;
default:
UNREACHABLE();
}
return res;
}
template <typename T_int, typename T_reg>
void Msa3RInstrHelper_shuffle(const uint32_t opcode, T_reg ws, T_reg wt,
T_reg wd, const int i, const int num_of_lanes) {
T_int *ws_p, *wt_p, *wd_p;
ws_p = reinterpret_cast<T_int*>(ws);
wt_p = reinterpret_cast<T_int*>(wt);
wd_p = reinterpret_cast<T_int*>(wd);
switch (opcode) {
case PCKEV:
wd_p[i] = wt_p[2 * i];
wd_p[i + num_of_lanes / 2] = ws_p[2 * i];
break;
case PCKOD:
wd_p[i] = wt_p[2 * i + 1];
wd_p[i + num_of_lanes / 2] = ws_p[2 * i + 1];
break;
case ILVL:
wd_p[2 * i] = wt_p[i + num_of_lanes / 2];
wd_p[2 * i + 1] = ws_p[i + num_of_lanes / 2];
break;
case ILVR:
wd_p[2 * i] = wt_p[i];
wd_p[2 * i + 1] = ws_p[i];
break;
case ILVEV:
wd_p[2 * i] = wt_p[2 * i];
wd_p[2 * i + 1] = ws_p[2 * i];
break;
case ILVOD:
wd_p[2 * i] = wt_p[2 * i + 1];
wd_p[2 * i + 1] = ws_p[2 * i + 1];
break;
case VSHF: {
const int mask_not_valid = 0xC0;
const int mask_6_bits = 0x3F;
if ((wd_p[i] & mask_not_valid)) {
wd_p[i] = 0;
} else {
int k = (wd_p[i] & mask_6_bits) % (num_of_lanes * 2);
wd_p[i] = k >= num_of_lanes ? ws_p[k - num_of_lanes] : wt_p[k];
}
} break;
default:
UNREACHABLE();
}
}
template <typename T_int, typename T_smaller_int, typename T_reg>
void Msa3RInstrHelper_horizontal(const uint32_t opcode, T_reg ws, T_reg wt,
T_reg wd, const int i,
const int num_of_lanes) {
using T_uint = typename std::make_unsigned<T_int>::type;
using T_smaller_uint = typename std::make_unsigned<T_smaller_int>::type;
T_int* wd_p;
T_smaller_int *ws_p, *wt_p;
ws_p = reinterpret_cast<T_smaller_int*>(ws);
wt_p = reinterpret_cast<T_smaller_int*>(wt);
wd_p = reinterpret_cast<T_int*>(wd);
T_uint* wd_pu;
T_smaller_uint *ws_pu, *wt_pu;
ws_pu = reinterpret_cast<T_smaller_uint*>(ws);
wt_pu = reinterpret_cast<T_smaller_uint*>(wt);
wd_pu = reinterpret_cast<T_uint*>(wd);
switch (opcode) {
case HADD_S:
wd_p[i] =
static_cast<T_int>(ws_p[2 * i + 1]) + static_cast<T_int>(wt_p[2 * i]);
break;
case HADD_U:
wd_pu[i] = static_cast<T_uint>(ws_pu[2 * i + 1]) +
static_cast<T_uint>(wt_pu[2 * i]);
break;
case HSUB_S:
wd_p[i] =
static_cast<T_int>(ws_p[2 * i + 1]) - static_cast<T_int>(wt_p[2 * i]);
break;
case HSUB_U:
wd_pu[i] = static_cast<T_uint>(ws_pu[2 * i + 1]) -
static_cast<T_uint>(wt_pu[2 * i]);
break;
default:
UNREACHABLE();
}
}
void Simulator::DecodeTypeMsa3R() {
DCHECK_EQ(kArchVariant, kMips64r6);
DCHECK(CpuFeatures::IsSupported(MIPS_SIMD));
uint32_t opcode = instr_.InstructionBits() & kMsa3RMask;
msa_reg_t ws, wd, wt;
get_msa_register(ws_reg(), &ws);
get_msa_register(wt_reg(), &wt);
get_msa_register(wd_reg(), &wd);
switch (opcode) {
case HADD_S:
case HADD_U:
case HSUB_S:
case HSUB_U:
#define HORIZONTAL_ARITHMETIC_DF(num_of_lanes, int_type, lesser_int_type) \
for (int i = 0; i < num_of_lanes; ++i) { \
Msa3RInstrHelper_horizontal<int_type, lesser_int_type>( \
opcode, &ws, &wt, &wd, i, num_of_lanes); \
}
switch (DecodeMsaDataFormat()) {
case MSA_HALF:
HORIZONTAL_ARITHMETIC_DF(kMSALanesHalf, int16_t, int8_t);
break;
case MSA_WORD:
HORIZONTAL_ARITHMETIC_DF(kMSALanesWord, int32_t, int16_t);
break;
case MSA_DWORD:
HORIZONTAL_ARITHMETIC_DF(kMSALanesDword, int64_t, int32_t);
break;
default:
UNREACHABLE();
}
break;
#undef HORIZONTAL_ARITHMETIC_DF
case VSHF:
#define VSHF_DF(num_of_lanes, int_type) \
for (int i = 0; i < num_of_lanes; ++i) { \
Msa3RInstrHelper_shuffle<int_type>(opcode, &ws, &wt, &wd, i, \
num_of_lanes); \
}
switch (DecodeMsaDataFormat()) {
case MSA_BYTE:
VSHF_DF(kMSALanesByte, int8_t);
break;
case MSA_HALF:
VSHF_DF(kMSALanesHalf, int16_t);
break;
case MSA_WORD:
VSHF_DF(kMSALanesWord, int32_t);
break;
case MSA_DWORD:
VSHF_DF(kMSALanesDword, int64_t);
break;
default:
UNREACHABLE();
}
#undef VSHF_DF
break;
case PCKEV:
case PCKOD:
case ILVL:
case ILVR:
case ILVEV:
case ILVOD:
#define INTERLEAVE_PACK_DF(num_of_lanes, int_type) \
for (int i = 0; i < num_of_lanes / 2; ++i) { \
Msa3RInstrHelper_shuffle<int_type>(opcode, &ws, &wt, &wd, i, \
num_of_lanes); \
}
switch (DecodeMsaDataFormat()) {
case MSA_BYTE:
INTERLEAVE_PACK_DF(kMSALanesByte, int8_t);
break;
case MSA_HALF:
INTERLEAVE_PACK_DF(kMSALanesHalf, int16_t);
break;
case MSA_WORD:
INTERLEAVE_PACK_DF(kMSALanesWord, int32_t);
break;
case MSA_DWORD:
INTERLEAVE_PACK_DF(kMSALanesDword, int64_t);
break;
default:
UNREACHABLE();
}
break;
#undef INTERLEAVE_PACK_DF
default:
#define MSA_3R_DF(elem, num_of_lanes) \
for (int i = 0; i < num_of_lanes; i++) { \
wd.elem[i] = Msa3RInstrHelper(opcode, wd.elem[i], ws.elem[i], wt.elem[i]); \
}
switch (DecodeMsaDataFormat()) {
case MSA_BYTE:
MSA_3R_DF(b, kMSALanesByte);
break;
case MSA_HALF:
MSA_3R_DF(h, kMSALanesHalf);
break;
case MSA_WORD:
MSA_3R_DF(w, kMSALanesWord);
break;
case MSA_DWORD:
MSA_3R_DF(d, kMSALanesDword);
break;
default:
UNREACHABLE();
}
#undef MSA_3R_DF
break;
}
set_msa_register(wd_reg(), &wd);
TraceMSARegWr(&wd);
}
template <typename T_int, typename T_fp, typename T_reg>
void Msa3RFInstrHelper(uint32_t opcode, T_reg ws, T_reg wt, T_reg* wd) {
const T_int all_ones = static_cast<T_int>(-1);
const T_fp s_element = *reinterpret_cast<T_fp*>(&ws);
const T_fp t_element = *reinterpret_cast<T_fp*>(&wt);
switch (opcode) {
case FCUN: {
if (std::isnan(s_element) || std::isnan(t_element)) {
*wd = all_ones;
} else {
*wd = 0;
}
} break;
case FCEQ: {
if (s_element != t_element || std::isnan(s_element) ||
std::isnan(t_element)) {
*wd = 0;
} else {
*wd = all_ones;
}
} break;
case FCUEQ: {
if (s_element == t_element || std::isnan(s_element) ||
std::isnan(t_element)) {
*wd = all_ones;
} else {
*wd = 0;
}
} break;
case FCLT: {
if (s_element >= t_element || std::isnan(s_element) ||
std::isnan(t_element)) {
*wd = 0;
} else {
*wd = all_ones;
}
} break;
case FCULT: {
if (s_element < t_element || std::isnan(s_element) ||
std::isnan(t_element)) {
*wd = all_ones;
} else {
*wd = 0;
}
} break;
case FCLE: {
if (s_element > t_element || std::isnan(s_element) ||
std::isnan(t_element)) {
*wd = 0;
} else {
*wd = all_ones;
}
} break;
case FCULE: {
if (s_element <= t_element || std::isnan(s_element) ||
std::isnan(t_element)) {
*wd = all_ones;
} else {
*wd = 0;
}
} break;
case FCOR: {
if (std::isnan(s_element) || std::isnan(t_element)) {
*wd = 0;
} else {
*wd = all_ones;
}
} break;
case FCUNE: {
if (s_element != t_element || std::isnan(s_element) ||
std::isnan(t_element)) {
*wd = all_ones;
} else {
*wd = 0;
}
} break;
case FCNE: {
if (s_element == t_element || std::isnan(s_element) ||
std::isnan(t_element)) {
*wd = 0;
} else {
*wd = all_ones;
}
} break;
case FADD:
*wd = bit_cast<T_int>(s_element + t_element);
break;
case FSUB:
*wd = bit_cast<T_int>(s_element - t_element);
break;
case FMUL:
*wd = bit_cast<T_int>(s_element * t_element);
break;
case FDIV: {
if (t_element == 0) {
*wd = bit_cast<T_int>(std::numeric_limits<T_fp>::quiet_NaN());
} else {
*wd = bit_cast<T_int>(s_element / t_element);
}
} break;
case FMADD:
*wd = bit_cast<T_int>(
std::fma(s_element, t_element, *reinterpret_cast<T_fp*>(wd)));
break;
case FMSUB:
*wd = bit_cast<T_int>(
std::fma(-s_element, t_element, *reinterpret_cast<T_fp*>(wd)));
break;
case FEXP2:
*wd = bit_cast<T_int>(std::ldexp(s_element, static_cast<int>(wt)));
break;
case FMIN:
*wd = bit_cast<T_int>(std::min(s_element, t_element));
break;
case FMAX:
*wd = bit_cast<T_int>(std::max(s_element, t_element));
break;
case FMIN_A: {
*wd = bit_cast<T_int>(
std::fabs(s_element) < std::fabs(t_element) ? s_element : t_element);
} break;
case FMAX_A: {
*wd = bit_cast<T_int>(
std::fabs(s_element) > std::fabs(t_element) ? s_element : t_element);
} break;
case FSOR:
case FSUNE:
case FSNE:
case FSAF:
case FSUN:
case FSEQ:
case FSUEQ:
case FSLT:
case FSULT:
case FSLE:
case FSULE:
UNIMPLEMENTED();
break;
default:
UNREACHABLE();
}
}
template <typename T_int, typename T_int_dbl, typename T_reg>
void Msa3RFInstrHelper2(uint32_t opcode, T_reg ws, T_reg wt, T_reg* wd) {
// using T_uint = typename std::make_unsigned<T_int>::type;
using T_uint_dbl = typename std::make_unsigned<T_int_dbl>::type;
const T_int max_int = std::numeric_limits<T_int>::max();
const T_int min_int = std::numeric_limits<T_int>::min();
const int shift = kBitsPerByte * sizeof(T_int) - 1;
const T_int_dbl reg_s = ws;
const T_int_dbl reg_t = wt;
T_int_dbl product, result;
product = reg_s * reg_t;
switch (opcode) {
case MUL_Q: {
const T_int_dbl min_fix_dbl =
bit_cast<T_uint_dbl>(std::numeric_limits<T_int_dbl>::min()) >> 1U;
const T_int_dbl max_fix_dbl = std::numeric_limits<T_int_dbl>::max() >> 1U;
if (product == min_fix_dbl) {
product = max_fix_dbl;
}
*wd = static_cast<T_int>(product >> shift);
} break;
case MADD_Q: {
result = (product + (static_cast<T_int_dbl>(*wd) << shift)) >> shift;
*wd = static_cast<T_int>(
result > max_int ? max_int : result < min_int ? min_int : result);
} break;
case MSUB_Q: {
result = (-product + (static_cast<T_int_dbl>(*wd) << shift)) >> shift;
*wd = static_cast<T_int>(
result > max_int ? max_int : result < min_int ? min_int : result);
} break;
case MULR_Q: {
const T_int_dbl min_fix_dbl =
bit_cast<T_uint_dbl>(std::numeric_limits<T_int_dbl>::min()) >> 1U;
const T_int_dbl max_fix_dbl = std::numeric_limits<T_int_dbl>::max() >> 1U;
if (product == min_fix_dbl) {
*wd = static_cast<T_int>(max_fix_dbl >> shift);
break;
}
*wd = static_cast<T_int>((product + (1 << (shift - 1))) >> shift);
} break;
case MADDR_Q: {
result = (product + (static_cast<T_int_dbl>(*wd) << shift) +
(1 << (shift - 1))) >>
shift;
*wd = static_cast<T_int>(
result > max_int ? max_int : result < min_int ? min_int : result);
} break;
case MSUBR_Q: {
result = (-product + (static_cast<T_int_dbl>(*wd) << shift) +
(1 << (shift - 1))) >>
shift;
*wd = static_cast<T_int>(
result > max_int ? max_int : result < min_int ? min_int : result);
} break;
default:
UNREACHABLE();
}
}
void Simulator::DecodeTypeMsa3RF() {
DCHECK_EQ(kArchVariant, kMips64r6);
DCHECK(CpuFeatures::IsSupported(MIPS_SIMD));
uint32_t opcode = instr_.InstructionBits() & kMsa3RFMask;
msa_reg_t wd, ws, wt;
if (opcode != FCAF) {
get_msa_register(ws_reg(), &ws);
get_msa_register(wt_reg(), &wt);
}
switch (opcode) {
case FCAF:
wd.d[0] = 0;
wd.d[1] = 0;
break;
case FEXDO:
#define PACK_FLOAT16(sign, exp, frac) \
static_cast<uint16_t>(((sign) << 15) + ((exp) << 10) + (frac))
#define FEXDO_DF(source, dst) \
do { \
element = source; \
aSign = element >> 31; \
aExp = element >> 23 & 0xFF; \
aFrac = element & 0x007FFFFF; \
if (aExp == 0xFF) { \
if (aFrac) { \
/* Input is a NaN */ \
dst = 0x7DFFU; \
break; \
} \
/* Infinity */ \
dst = PACK_FLOAT16(aSign, 0x1F, 0); \
break; \
} else if (aExp == 0 && aFrac == 0) { \
dst = PACK_FLOAT16(aSign, 0, 0); \
break; \
} else { \
int maxexp = 29; \
uint32_t mask; \
uint32_t increment; \
bool rounding_bumps_exp; \
aFrac |= 0x00800000; \
aExp -= 0x71; \
if (aExp < 1) { \
/* Will be denormal in halfprec */ \
mask = 0x00FFFFFF; \
if (aExp >= -11) { \
mask >>= 11 + aExp; \
} \
} else { \
/* Normal number in halfprec */ \
mask = 0x00001FFF; \
} \
switch (MSACSR_ & 3) { \
case kRoundToNearest: \
increment = (mask + 1) >> 1; \
if ((aFrac & mask) == increment) { \
increment = aFrac & (increment << 1); \
} \
break; \
case kRoundToPlusInf: \
increment = aSign ? 0 : mask; \
break; \
case kRoundToMinusInf: \
increment = aSign ? mask : 0; \
break; \
case kRoundToZero: \
increment = 0; \
break; \
} \
rounding_bumps_exp = (aFrac + increment >= 0x01000000); \
if (aExp > maxexp || (aExp == maxexp && rounding_bumps_exp)) { \
dst = PACK_FLOAT16(aSign, 0x1F, 0); \
break; \
} \
aFrac += increment; \
if (rounding_bumps_exp) { \
aFrac >>= 1; \
aExp++; \
} \
if (aExp < -10) { \
dst = PACK_FLOAT16(aSign, 0, 0); \
break; \
} \
if (aExp < 0) { \
aFrac >>= -aExp; \
aExp = 0; \
} \
dst = PACK_FLOAT16(aSign, aExp, aFrac >> 13); \
} \
} while (0);
switch (DecodeMsaDataFormat()) {
case MSA_HALF:
for (int i = 0; i < kMSALanesWord; i++) {
uint_fast32_t element;
uint_fast32_t aSign, aFrac;
int_fast32_t aExp;
FEXDO_DF(ws.uw[i], wd.uh[i + kMSALanesHalf / 2])
FEXDO_DF(wt.uw[i], wd.uh[i])
}
break;
case MSA_WORD:
for (int i = 0; i < kMSALanesDword; i++) {
wd.w[i + kMSALanesWord / 2] = bit_cast<int32_t>(
static_cast<float>(bit_cast<double>(ws.d[i])));
wd.w[i] = bit_cast<int32_t>(
static_cast<float>(bit_cast<double>(wt.d[i])));
}
break;
default:
UNREACHABLE();
}
break;
#undef PACK_FLOAT16
#undef FEXDO_DF
case FTQ:
#define FTQ_DF(source, dst, fp_type, int_type) \
element = bit_cast<fp_type>(source) * \
(1U << (sizeof(int_type) * kBitsPerByte - 1)); \
if (element > std::numeric_limits<int_type>::max()) { \
dst = std::numeric_limits<int_type>::max(); \
} else if (element < std::numeric_limits<int_type>::min()) { \
dst = std::numeric_limits<int_type>::min(); \
} else if (std::isnan(element)) { \
dst = 0; \
} else { \
int_type fixed_point; \
round_according_to_msacsr(element, &element, &fixed_point); \
dst = fixed_point; \
}
switch (DecodeMsaDataFormat()) {
case MSA_HALF:
for (int i = 0; i < kMSALanesWord; i++) {
float element;
FTQ_DF(ws.w[i], wd.h[i + kMSALanesHalf / 2], float, int16_t)
FTQ_DF(wt.w[i], wd.h[i], float, int16_t)
}
break;
case MSA_WORD:
double element;
for (int i = 0; i < kMSALanesDword; i++) {
FTQ_DF(ws.d[i], wd.w[i + kMSALanesWord / 2], double, int32_t)
FTQ_DF(wt.d[i], wd.w[i], double, int32_t)
}
break;
default:
UNREACHABLE();
}
break;
#undef FTQ_DF
#define MSA_3RF_DF(T1, T2, Lanes, ws, wt, wd) \
for (int i = 0; i < Lanes; i++) { \
Msa3RFInstrHelper<T1, T2>(opcode, ws, wt, &(wd)); \
}
#define MSA_3RF_DF2(T1, T2, Lanes, ws, wt, wd) \
for (int i = 0; i < Lanes; i++) { \
Msa3RFInstrHelper2<T1, T2>(opcode, ws, wt, &(wd)); \
}
case MADD_Q:
case MSUB_Q:
case MADDR_Q:
case MSUBR_Q:
get_msa_register(wd_reg(), &wd);
V8_FALLTHROUGH;
case MUL_Q:
case MULR_Q:
switch (DecodeMsaDataFormat()) {
case MSA_HALF:
MSA_3RF_DF2(int16_t, int32_t, kMSALanesHalf, ws.h[i], wt.h[i],
wd.h[i])
break;
case MSA_WORD:
MSA_3RF_DF2(int32_t, int64_t, kMSALanesWord, ws.w[i], wt.w[i],
wd.w[i])
break;
default:
UNREACHABLE();
}
break;
default:
if (opcode == FMADD || opcode == FMSUB) {
get_msa_register(wd_reg(), &wd);
}
switch (DecodeMsaDataFormat()) {
case MSA_WORD:
MSA_3RF_DF(int32_t, float, kMSALanesWord, ws.w[i], wt.w[i], wd.w[i])
break;
case MSA_DWORD:
MSA_3RF_DF(int64_t, double, kMSALanesDword, ws.d[i], wt.d[i], wd.d[i])
break;
default:
UNREACHABLE();
}
break;
#undef MSA_3RF_DF
#undef MSA_3RF_DF2
}
set_msa_register(wd_reg(), &wd);
TraceMSARegWr(&wd);
}
void Simulator::DecodeTypeMsaVec() {
DCHECK_EQ(kArchVariant, kMips64r6);
DCHECK(CpuFeatures::IsSupported(MIPS_SIMD));
uint32_t opcode = instr_.InstructionBits() & kMsaVECMask;
msa_reg_t wd, ws, wt;
get_msa_register(instr_.WsValue(), ws.d);
get_msa_register(instr_.WtValue(), wt.d);
if (opcode == BMNZ_V || opcode == BMZ_V || opcode == BSEL_V) {
get_msa_register(instr_.WdValue(), wd.d);
}
for (int i = 0; i < kMSALanesDword; i++) {
switch (opcode) {
case AND_V:
wd.d[i] = ws.d[i] & wt.d[i];
break;
case OR_V:
wd.d[i] = ws.d[i] | wt.d[i];
break;
case NOR_V:
wd.d[i] = ~(ws.d[i] | wt.d[i]);
break;
case XOR_V:
wd.d[i] = ws.d[i] ^ wt.d[i];
break;
case BMNZ_V:
wd.d[i] = (wt.d[i] & ws.d[i]) | (~wt.d[i] & wd.d[i]);
break;
case BMZ_V:
wd.d[i] = (~wt.d[i] & ws.d[i]) | (wt.d[i] & wd.d[i]);
break;
case BSEL_V:
wd.d[i] = (~wd.d[i] & ws.d[i]) | (wd.d[i] & wt.d[i]);
break;
default:
UNREACHABLE();
}
}
set_msa_register(instr_.WdValue(), wd.d);
TraceMSARegWr(wd.d);
}
void Simulator::DecodeTypeMsa2R() {
DCHECK_EQ(kArchVariant, kMips64r6);
DCHECK(CpuFeatures::IsSupported(MIPS_SIMD));
uint32_t opcode = instr_.InstructionBits() & kMsa2RMask;
msa_reg_t wd, ws;
switch (opcode) {
case FILL:
switch (DecodeMsaDataFormat()) {
case MSA_BYTE: {
int64_t rs = get_register(instr_.WsValue());
for (int i = 0; i < kMSALanesByte; i++) {
wd.b[i] = rs & 0xFFu;
}
set_msa_register(instr_.WdValue(), wd.b);
TraceMSARegWr(wd.b);
break;
}
case MSA_HALF: {
int64_t rs = get_register(instr_.WsValue());
for (int i = 0; i < kMSALanesHalf; i++) {
wd.h[i] = rs & 0xFFFFu;
}
set_msa_register(instr_.WdValue(), wd.h);
TraceMSARegWr(wd.h);
break;
}
case MSA_WORD: {
int64_t rs = get_register(instr_.WsValue());
for (int i = 0; i < kMSALanesWord; i++) {
wd.w[i] = rs & 0xFFFFFFFFu;
}
set_msa_register(instr_.WdValue(), wd.w);
TraceMSARegWr(wd.w);
break;
}
case MSA_DWORD: {
int64_t rs = get_register(instr_.WsValue());
wd.d[0] = wd.d[1] = rs;
set_msa_register(instr_.WdValue(), wd.d);
TraceMSARegWr(wd.d);
break;
}
default:
UNREACHABLE();
}
break;
case PCNT:
#define PCNT_DF(elem, num_of_lanes) \
get_msa_register(instr_.WsValue(), ws.elem); \
for (int i = 0; i < num_of_lanes; i++) { \
uint64_t u64elem = static_cast<uint64_t>(ws.elem[i]); \
wd.elem[i] = base::bits::CountPopulation(u64elem); \
} \
set_msa_register(instr_.WdValue(), wd.elem); \
TraceMSARegWr(wd.elem)
switch (DecodeMsaDataFormat()) {
case MSA_BYTE:
PCNT_DF(ub, kMSALanesByte);
break;
case MSA_HALF:
PCNT_DF(uh, kMSALanesHalf);
break;
case MSA_WORD:
PCNT_DF(uw, kMSALanesWord);
break;
case MSA_DWORD:
PCNT_DF(ud, kMSALanesDword);
break;
default:
UNREACHABLE();
}
#undef PCNT_DF
break;
case NLOC:
#define NLOC_DF(elem, num_of_lanes) \
get_msa_register(instr_.WsValue(), ws.elem); \
for (int i = 0; i < num_of_lanes; i++) { \
const uint64_t mask = (num_of_lanes == kMSALanesDword) \
? UINT64_MAX \
: (1ULL << (kMSARegSize / num_of_lanes)) - 1; \
uint64_t u64elem = static_cast<uint64_t>(~ws.elem[i]) & mask; \
wd.elem[i] = base::bits::CountLeadingZeros64(u64elem) - \
(64 - kMSARegSize / num_of_lanes); \
} \
set_msa_register(instr_.WdValue(), wd.elem); \
TraceMSARegWr(wd.elem)
switch (DecodeMsaDataFormat()) {
case MSA_BYTE:
NLOC_DF(ub, kMSALanesByte);
break;
case MSA_HALF:
NLOC_DF(uh, kMSALanesHalf);
break;
case MSA_WORD:
NLOC_DF(uw, kMSALanesWord);
break;
case MSA_DWORD:
NLOC_DF(ud, kMSALanesDword);
break;
default:
UNREACHABLE();
}
#undef NLOC_DF
break;
case NLZC:
#define NLZC_DF(elem, num_of_lanes) \
get_msa_register(instr_.WsValue(), ws.elem); \
for (int i = 0; i < num_of_lanes; i++) { \
uint64_t u64elem = static_cast<uint64_t>(ws.elem[i]); \
wd.elem[i] = base::bits::CountLeadingZeros64(u64elem) - \
(64 - kMSARegSize / num_of_lanes); \
} \
set_msa_register(instr_.WdValue(), wd.elem); \
TraceMSARegWr(wd.elem)
switch (DecodeMsaDataFormat()) {
case MSA_BYTE:
NLZC_DF(ub, kMSALanesByte);
break;
case MSA_HALF:
NLZC_DF(uh, kMSALanesHalf);
break;
case MSA_WORD:
NLZC_DF(uw, kMSALanesWord);
break;
case MSA_DWORD:
NLZC_DF(ud, kMSALanesDword);
break;
default:
UNREACHABLE();
}
#undef NLZC_DF
break;
default:
UNREACHABLE();
}
}
#define BIT(n) (0x1LL << n)
#define QUIET_BIT_S(nan) (bit_cast<int32_t>(nan) & BIT(22))
#define QUIET_BIT_D(nan) (bit_cast<int64_t>(nan) & BIT(51))
static inline bool isSnan(float fp) { return !QUIET_BIT_S(fp); }
static inline bool isSnan(double fp) { return !QUIET_BIT_D(fp); }
#undef QUIET_BIT_S
#undef QUIET_BIT_D
template <typename T_int, typename T_fp, typename T_src, typename T_dst>
T_int Msa2RFInstrHelper(uint32_t opcode, T_src src, T_dst* dst,
Simulator* sim) {
using T_uint = typename std::make_unsigned<T_int>::type;
switch (opcode) {
case FCLASS: {
#define SNAN_BIT BIT(0)
#define QNAN_BIT BIT(1)
#define NEG_INFINITY_BIT BIT(2)
#define NEG_NORMAL_BIT BIT(3)
#define NEG_SUBNORMAL_BIT BIT(4)
#define NEG_ZERO_BIT BIT(5)
#define POS_INFINITY_BIT BIT(6)
#define POS_NORMAL_BIT BIT(7)
#define POS_SUBNORMAL_BIT BIT(8)
#define POS_ZERO_BIT BIT(9)
T_fp element = *reinterpret_cast<T_fp*>(&src);
switch (std::fpclassify(element)) {
case FP_INFINITE:
if (std::signbit(element)) {
*dst = NEG_INFINITY_BIT;
} else {
*dst = POS_INFINITY_BIT;
}
break;
case FP_NAN:
if (isSnan(element)) {
*dst = SNAN_BIT;
} else {
*dst = QNAN_BIT;
}
break;
case FP_NORMAL:
if (std::signbit(element)) {
*dst = NEG_NORMAL_BIT;
} else {
*dst = POS_NORMAL_BIT;
}
break;
case FP_SUBNORMAL:
if (std::signbit(element)) {
*dst = NEG_SUBNORMAL_BIT;
} else {
*dst = POS_SUBNORMAL_BIT;
}
break;
case FP_ZERO:
if (std::signbit(element)) {
*dst = NEG_ZERO_BIT;
} else {
*dst = POS_ZERO_BIT;
}
break;
default:
UNREACHABLE();
}
break;
}
#undef BIT
#undef SNAN_BIT
#undef QNAN_BIT
#undef NEG_INFINITY_BIT
#undef NEG_NORMAL_BIT
#undef NEG_SUBNORMAL_BIT
#undef NEG_ZERO_BIT
#undef POS_INFINITY_BIT
#undef POS_NORMAL_BIT
#undef POS_SUBNORMAL_BIT
#undef POS_ZERO_BIT
case FTRUNC_S: {
T_fp element = bit_cast<T_fp>(src);
const T_int max_int = std::numeric_limits<T_int>::max();
const T_int min_int = std::numeric_limits<T_int>::min();
if (std::isnan(element)) {
*dst = 0;
} else if (element >= max_int || element <= min_int) {
*dst = element >= max_int ? max_int : min_int;
} else {
*dst = static_cast<T_int>(std::trunc(element));
}
break;
}
case FTRUNC_U: {
T_fp element = bit_cast<T_fp>(src);
const T_uint max_int = std::numeric_limits<T_uint>::max();
if (std::isnan(element)) {
*dst = 0;
} else if (element >= max_int || element <= 0) {
*dst = element >= max_int ? max_int : 0;
} else {
*dst = static_cast<T_uint>(std::trunc(element));
}
break;
}
case FSQRT: {
T_fp element = bit_cast<T_fp>(src);
if (element < 0 || std::isnan(element)) {
*dst = bit_cast<T_int>(std::numeric_limits<T_fp>::quiet_NaN());
} else {
*dst = bit_cast<T_int>(std::sqrt(element));
}
break;
}
case FRSQRT: {
T_fp element = bit_cast<T_fp>(src);
if (element < 0 || std::isnan(element)) {
*dst = bit_cast<T_int>(std::numeric_limits<T_fp>::quiet_NaN());
} else {
*dst = bit_cast<T_int>(1 / std::sqrt(element));
}
break;
}
case FRCP: {
T_fp element = bit_cast<T_fp>(src);
if (std::isnan(element)) {
*dst = bit_cast<T_int>(std::numeric_limits<T_fp>::quiet_NaN());
} else {
*dst = bit_cast<T_int>(1 / element);
}
break;
}
case FRINT: {
T_fp element = bit_cast<T_fp>(src);
if (std::isnan(element)) {
*dst = bit_cast<T_int>(std::numeric_limits<T_fp>::quiet_NaN());
} else {
T_int dummy;
sim->round_according_to_msacsr<T_fp, T_int>(element, &element, &dummy);
*dst = bit_cast<T_int>(element);
}
break;
}
case FLOG2: {
T_fp element = bit_cast<T_fp>(src);
switch (std::fpclassify(element)) {
case FP_NORMAL:
case FP_SUBNORMAL:
*dst = bit_cast<T_int>(std::logb(element));
break;
case FP_ZERO:
*dst = bit_cast<T_int>(-std::numeric_limits<T_fp>::infinity());
break;
case FP_NAN:
*dst = bit_cast<T_int>(std::numeric_limits<T_fp>::quiet_NaN());
break;
case FP_INFINITE:
if (element < 0) {
*dst = bit_cast<T_int>(std::numeric_limits<T_fp>::quiet_NaN());
} else {
*dst = bit_cast<T_int>(std::numeric_limits<T_fp>::infinity());
}
break;
default:
UNREACHABLE();
}
break;
}
case FTINT_S: {
T_fp element = bit_cast<T_fp>(src);
const T_int max_int = std::numeric_limits<T_int>::max();
const T_int min_int = std::numeric_limits<T_int>::min();
if (std::isnan(element)) {
*dst = 0;
} else if (element < min_int || element > max_int) {
*dst = element > max_int ? max_int : min_int;
} else {
sim->round_according_to_msacsr<T_fp, T_int>(element, &element, dst);
}
break;
}
case FTINT_U: {
T_fp element = bit_cast<T_fp>(src);
const T_uint max_uint = std::numeric_limits<T_uint>::max();
if (std::isnan(element)) {
*dst = 0;
} else if (element < 0 || element > max_uint) {
*dst = element > max_uint ? max_uint : 0;
} else {
T_uint res;
sim->round_according_to_msacsr<T_fp, T_uint>(element, &element, &res);
*dst = *reinterpret_cast<T_int*>(&res);
}
break;
}
case FFINT_S:
*dst = bit_cast<T_int>(static_cast<T_fp>(src));
break;
case FFINT_U:
using uT_src = typename std::make_unsigned<T_src>::type;
*dst = bit_cast<T_int>(static_cast<T_fp>(bit_cast<uT_src>(src)));
break;
default:
UNREACHABLE();
}
return 0;
}
template <typename T_int, typename T_fp, typename T_reg>
T_int Msa2RFInstrHelper2(uint32_t opcode, T_reg ws, int i) {
switch (opcode) {
#define EXTRACT_FLOAT16_SIGN(fp16) (fp16 >> 15)
#define EXTRACT_FLOAT16_EXP(fp16) (fp16 >> 10 & 0x1F)
#define EXTRACT_FLOAT16_FRAC(fp16) (fp16 & 0x3FF)
#define PACK_FLOAT32(sign, exp, frac) \
static_cast<uint32_t>(((sign) << 31) + ((exp) << 23) + (frac))
#define FEXUP_DF(src_index) \
uint_fast16_t element = ws.uh[src_index]; \
uint_fast32_t aSign, aFrac; \
int_fast32_t aExp; \
aSign = EXTRACT_FLOAT16_SIGN(element); \
aExp = EXTRACT_FLOAT16_EXP(element); \
aFrac = EXTRACT_FLOAT16_FRAC(element); \
if (V8_LIKELY(aExp && aExp != 0x1F)) { \
return PACK_FLOAT32(aSign, aExp + 0x70, aFrac << 13); \
} else if (aExp == 0x1F) { \
if (aFrac) { \
return bit_cast<int32_t>(std::numeric_limits<float>::quiet_NaN()); \
} else { \
return bit_cast<uint32_t>(std::numeric_limits<float>::infinity()) | \
static_cast<uint32_t>(aSign) << 31; \
} \
} else { \
if (aFrac == 0) { \
return PACK_FLOAT32(aSign, 0, 0); \
} else { \
int_fast16_t shiftCount = \
base::bits::CountLeadingZeros32(static_cast<uint32_t>(aFrac)) - 21; \
aFrac <<= shiftCount; \
aExp = -shiftCount; \
return PACK_FLOAT32(aSign, aExp + 0x70, aFrac << 13); \
} \
}
case FEXUPL:
if (std::is_same<int32_t, T_int>::value) {
FEXUP_DF(i + kMSALanesWord)
} else {
return bit_cast<int64_t>(
static_cast<double>(bit_cast<float>(ws.w[i + kMSALanesDword])));
}
case FEXUPR:
if (std::is_same<int32_t, T_int>::value) {
FEXUP_DF(i)
} else {
return bit_cast<int64_t>(static_cast<double>(bit_cast<float>(ws.w[i])));
}
case FFQL: {
if (std::is_same<int32_t, T_int>::value) {
return bit_cast<int32_t>(static_cast<float>(ws.h[i + kMSALanesWord]) /
(1U << 15));
} else {
return bit_cast<int64_t>(static_cast<double>(ws.w[i + kMSALanesDword]) /
(1U << 31));
}
break;
}
case FFQR: {
if (std::is_same<int32_t, T_int>::value) {
return bit_cast<int32_t>(static_cast<float>(ws.h[i]) / (1U << 15));
} else {
return bit_cast<int64_t>(static_cast<double>(ws.w[i]) / (1U << 31));
}
break;
default:
UNREACHABLE();
}
}
#undef EXTRACT_FLOAT16_SIGN
#undef EXTRACT_FLOAT16_EXP
#undef EXTRACT_FLOAT16_FRAC
#undef PACK_FLOAT32
#undef FEXUP_DF
}
void Simulator::DecodeTypeMsa2RF() {
DCHECK_EQ(kArchVariant, kMips64r6);
DCHECK(CpuFeatures::IsSupported(MIPS_SIMD));
uint32_t opcode = instr_.InstructionBits() & kMsa2RFMask;
msa_reg_t wd, ws;
get_msa_register(ws_reg(), &ws);
if (opcode == FEXUPL || opcode == FEXUPR || opcode == FFQL ||
opcode == FFQR) {
switch (DecodeMsaDataFormat()) {
case MSA_WORD:
for (int i = 0; i < kMSALanesWord; i++) {
wd.w[i] = Msa2RFInstrHelper2<int32_t, float>(opcode, ws, i);
}
break;
case MSA_DWORD:
for (int i = 0; i < kMSALanesDword; i++) {
wd.d[i] = Msa2RFInstrHelper2<int64_t, double>(opcode, ws, i);
}
break;
default:
UNREACHABLE();
}
} else {
switch (DecodeMsaDataFormat()) {
case MSA_WORD:
for (int i = 0; i < kMSALanesWord; i++) {
Msa2RFInstrHelper<int32_t, float>(opcode, ws.w[i], &wd.w[i], this);
}
break;
case MSA_DWORD:
for (int i = 0; i < kMSALanesDword; i++) {
Msa2RFInstrHelper<int64_t, double>(opcode, ws.d[i], &wd.d[i], this);
}
break;
default:
UNREACHABLE();
}
}
set_msa_register(wd_reg(), &wd);
TraceMSARegWr(&wd);
}
void Simulator::DecodeTypeRegister() {
// ---------- Execution.
switch (instr_.OpcodeFieldRaw()) {
case COP1:
DecodeTypeRegisterCOP1();
break;
case COP1X:
DecodeTypeRegisterCOP1X();
break;
case SPECIAL:
DecodeTypeRegisterSPECIAL();
break;
case SPECIAL2:
DecodeTypeRegisterSPECIAL2();
break;
case SPECIAL3:
DecodeTypeRegisterSPECIAL3();
break;
case MSA:
switch (instr_.MSAMinorOpcodeField()) {
case kMsaMinor3R:
DecodeTypeMsa3R();
break;
case kMsaMinor3RF:
DecodeTypeMsa3RF();
break;
case kMsaMinorVEC:
DecodeTypeMsaVec();
break;
case kMsaMinor2R:
DecodeTypeMsa2R();
break;
case kMsaMinor2RF:
DecodeTypeMsa2RF();
break;
case kMsaMinorELM:
DecodeTypeMsaELM();
break;
default:
UNREACHABLE();
}
break;
// Unimplemented opcodes raised an error in the configuration step before,
// so we can use the default here to set the destination register in common
// cases.
default:
UNREACHABLE();
}
}
// Type 2: instructions using a 16, 21 or 26 bits immediate. (e.g. beq, beqc).
void Simulator::DecodeTypeImmediate() {
// Instruction fields.
Opcode op = instr_.OpcodeFieldRaw();
int32_t rs_reg = instr_.RsValue();
int64_t rs = get_register(instr_.RsValue());
uint64_t rs_u = static_cast<uint64_t>(rs);
int32_t rt_reg = instr_.RtValue(); // Destination register.
int64_t rt = get_register(rt_reg);
int16_t imm16 = instr_.Imm16Value();
int32_t imm18 = instr_.Imm18Value();
int32_t ft_reg = instr_.FtValue(); // Destination register.
// Zero extended immediate.
uint64_t oe_imm16 = 0xFFFF & imm16;
// Sign extended immediate.
int64_t se_imm16 = imm16;
int64_t se_imm18 = imm18 | ((imm18 & 0x20000) ? 0xFFFFFFFFFFFC0000 : 0);
// Next pc.
int64_t next_pc = bad_ra;
// Used for conditional branch instructions.
bool execute_branch_delay_instruction = false;
// Used for arithmetic instructions.
int64_t alu_out = 0;
// Used for memory instructions.
int64_t addr = 0x0;
// Alignment for 32-bit integers used in LWL, LWR, etc.
const int kInt32AlignmentMask = sizeof(uint32_t) - 1;
// Alignment for 64-bit integers used in LDL, LDR, etc.
const int kInt64AlignmentMask = sizeof(uint64_t) - 1;
// Branch instructions common part.
auto BranchAndLinkHelper =
[this, &next_pc, &execute_branch_delay_instruction](bool do_branch) {
execute_branch_delay_instruction = true;
int64_t current_pc = get_pc();
set_register(31, current_pc + 2 * kInstrSize);
if (do_branch) {
int16_t imm16 = instr_.Imm16Value();
next_pc = current_pc + (imm16 << 2) + kInstrSize;
} else {
next_pc = current_pc + 2 * kInstrSize;
}
};
auto BranchHelper = [this, &next_pc,
&execute_branch_delay_instruction](bool do_branch) {
execute_branch_delay_instruction = true;
int64_t current_pc = get_pc();
if (do_branch) {
int16_t imm16 = instr_.Imm16Value();
next_pc = current_pc + (imm16 << 2) + kInstrSize;
} else {
next_pc = current_pc + 2 * kInstrSize;
}
};
auto BranchHelper_MSA = [this, &next_pc, imm16,
&execute_branch_delay_instruction](bool do_branch) {
execute_branch_delay_instruction = true;
int64_t current_pc = get_pc();
const int32_t bitsIn16Int = sizeof(int16_t) * kBitsPerByte;
if (do_branch) {
if (FLAG_debug_code) {
int16_t bits = imm16 & 0xFC;
if (imm16 >= 0) {
CHECK_EQ(bits, 0);
} else {
CHECK_EQ(bits ^ 0xFC, 0);
}
}
// jump range :[pc + kInstrSize - 512 * kInstrSize,
// pc + kInstrSize + 511 * kInstrSize]
int16_t offset = static_cast<int16_t>(imm16 << (bitsIn16Int - 10)) >>
(bitsIn16Int - 12);
next_pc = current_pc + offset + kInstrSize;
} else {
next_pc = current_pc + 2 * kInstrSize;
}
};
auto BranchAndLinkCompactHelper = [this, &next_pc](bool do_branch, int bits) {
int64_t current_pc = get_pc();
CheckForbiddenSlot(current_pc);
if (do_branch) {
int32_t imm = instr_.ImmValue(bits);
imm <<= 32 - bits;
imm >>= 32 - bits;
next_pc = current_pc + (imm << 2) + kInstrSize;
set_register(31, current_pc + kInstrSize);
}
};
auto BranchCompactHelper = [this, &next_pc](bool do_branch, int bits) {
int64_t current_pc = get_pc();
CheckForbiddenSlot(current_pc);
if (do_branch) {
int32_t imm = instr_.ImmValue(bits);
imm <<= 32 - bits;
imm >>= 32 - bits;
next_pc = get_pc() + (imm << 2) + kInstrSize;
}
};
switch (op) {
// ------------- COP1. Coprocessor instructions.
case COP1:
switch (instr_.RsFieldRaw()) {
case BC1: { // Branch on coprocessor condition.
uint32_t cc = instr_.FBccValue();
uint32_t fcsr_cc = get_fcsr_condition_bit(cc);
uint32_t cc_value = test_fcsr_bit(fcsr_cc);
bool do_branch = (instr_.FBtrueValue()) ? cc_value : !cc_value;
BranchHelper(do_branch);
break;
}
case BC1EQZ:
BranchHelper(!(get_fpu_register(ft_reg) & 0x1));
break;
case BC1NEZ:
BranchHelper(get_fpu_register(ft_reg) & 0x1);
break;
case BZ_V: {
msa_reg_t wt;
get_msa_register(wt_reg(), &wt);
BranchHelper_MSA(wt.d[0] == 0 && wt.d[1] == 0);
} break;
#define BZ_DF(witdh, lanes) \
{ \
msa_reg_t wt; \
get_msa_register(wt_reg(), &wt); \
int i; \
for (i = 0; i < lanes; ++i) { \
if (wt.witdh[i] == 0) { \
break; \
} \
} \
BranchHelper_MSA(i != lanes); \
}
case BZ_B:
BZ_DF(b, kMSALanesByte)
break;
case BZ_H:
BZ_DF(h, kMSALanesHalf)
break;
case BZ_W:
BZ_DF(w, kMSALanesWord)
break;
case BZ_D:
BZ_DF(d, kMSALanesDword)
break;
#undef BZ_DF
case BNZ_V: {
msa_reg_t wt;
get_msa_register(wt_reg(), &wt);
BranchHelper_MSA(wt.d[0] != 0 || wt.d[1] != 0);
} break;
#define BNZ_DF(witdh, lanes) \
{ \
msa_reg_t wt; \
get_msa_register(wt_reg(), &wt); \
int i; \
for (i = 0; i < lanes; ++i) { \
if (wt.witdh[i] == 0) { \
break; \
} \
} \
BranchHelper_MSA(i == lanes); \
}
case BNZ_B:
BNZ_DF(b, kMSALanesByte)
break;
case BNZ_H:
BNZ_DF(h, kMSALanesHalf)
break;
case BNZ_W:
BNZ_DF(w, kMSALanesWord)
break;
case BNZ_D:
BNZ_DF(d, kMSALanesDword)
break;
#undef BNZ_DF
default:
UNREACHABLE();
}
break;
// ------------- REGIMM class.
case REGIMM:
switch (instr_.RtFieldRaw()) {
case BLTZ:
BranchHelper(rs < 0);
break;
case BGEZ:
BranchHelper(rs >= 0);
break;
case BLTZAL:
BranchAndLinkHelper(rs < 0);
break;
case BGEZAL:
BranchAndLinkHelper(rs >= 0);
break;
case DAHI:
SetResult(rs_reg, rs + (se_imm16 << 32));
break;
case DATI:
SetResult(rs_reg, rs + (se_imm16 << 48));
break;
default:
UNREACHABLE();
}
break; // case REGIMM.
// ------------- Branch instructions.
// When comparing to zero, the encoding of rt field is always 0, so we don't
// need to replace rt with zero.
case BEQ:
BranchHelper(rs == rt);
break;
case BNE:
BranchHelper(rs != rt);
break;
case POP06: // BLEZALC, BGEZALC, BGEUC, BLEZ (pre-r6)
if (kArchVariant == kMips64r6) {
if (rt_reg != 0) {
if (rs_reg == 0) { // BLEZALC
BranchAndLinkCompactHelper(rt <= 0, 16);
} else {
if (rs_reg == rt_reg) { // BGEZALC
BranchAndLinkCompactHelper(rt >= 0, 16);
} else { // BGEUC
BranchCompactHelper(
static_cast<uint64_t>(rs) >= static_cast<uint64_t>(rt), 16);
}
}
} else { // BLEZ
BranchHelper(rs <= 0);
}
} else { // BLEZ
BranchHelper(rs <= 0);
}
break;
case POP07: // BGTZALC, BLTZALC, BLTUC, BGTZ (pre-r6)
if (kArchVariant == kMips64r6) {
if (rt_reg != 0) {
if (rs_reg == 0) { // BGTZALC
BranchAndLinkCompactHelper(rt > 0, 16);
} else {
if (rt_reg == rs_reg) { // BLTZALC
BranchAndLinkCompactHelper(rt < 0, 16);
} else { // BLTUC
BranchCompactHelper(
static_cast<uint64_t>(rs) < static_cast<uint64_t>(rt), 16);
}
}
} else { // BGTZ
BranchHelper(rs > 0);
}
} else { // BGTZ
BranchHelper(rs > 0);
}
break;
case POP26: // BLEZC, BGEZC, BGEC/BLEC / BLEZL (pre-r6)
if (kArchVariant == kMips64r6) {
if (rt_reg != 0) {
if (rs_reg == 0) { // BLEZC
BranchCompactHelper(rt <= 0, 16);
} else {
if (rs_reg == rt_reg) { // BGEZC
BranchCompactHelper(rt >= 0, 16);
} else { // BGEC/BLEC
BranchCompactHelper(rs >= rt, 16);
}
}
}
} else { // BLEZL
BranchAndLinkHelper(rs <= 0);
}
break;
case POP27: // BGTZC, BLTZC, BLTC/BGTC / BGTZL (pre-r6)
if (kArchVariant == kMips64r6) {
if (rt_reg != 0) {
if (rs_reg == 0) { // BGTZC
BranchCompactHelper(rt > 0, 16);
} else {
if (rs_reg == rt_reg) { // BLTZC
BranchCompactHelper(rt < 0, 16);
} else { // BLTC/BGTC
BranchCompactHelper(rs < rt, 16);
}
}
}
} else { // BGTZL
BranchAndLinkHelper(rs > 0);
}
break;
case POP66: // BEQZC, JIC
if (rs_reg != 0) { // BEQZC
BranchCompactHelper(rs == 0, 21);
} else { // JIC
next_pc = rt + imm16;
}
break;
case POP76: // BNEZC, JIALC
if (rs_reg != 0) { // BNEZC
BranchCompactHelper(rs != 0, 21);
} else { // JIALC
int64_t current_pc = get_pc();
set_register(31, current_pc + kInstrSize);
next_pc = rt + imm16;
}
break;
case BC:
BranchCompactHelper(true, 26);
break;
case BALC:
BranchAndLinkCompactHelper(true, 26);
break;
case POP10: // BOVC, BEQZALC, BEQC / ADDI (pre-r6)
if (kArchVariant == kMips64r6) {
if (rs_reg >= rt_reg) { // BOVC
bool condition = !is_int32(rs) || !is_int32(rt) || !is_int32(rs + rt);
BranchCompactHelper(condition, 16);
} else {
if (rs_reg == 0) { // BEQZALC
BranchAndLinkCompactHelper(rt == 0, 16);
} else { // BEQC
BranchCompactHelper(rt == rs, 16);
}
}
} else { // ADDI
if (HaveSameSign(rs, se_imm16)) {
if (rs > 0) {
if (rs <= Registers::kMaxValue - se_imm16) {
SignalException(kIntegerOverflow);
}
} else if (rs < 0) {
if (rs >= Registers::kMinValue - se_imm16) {
SignalException(kIntegerUnderflow);
}
}
}
SetResult(rt_reg, rs + se_imm16);
}
break;
case POP30: // BNVC, BNEZALC, BNEC / DADDI (pre-r6)
if (kArchVariant == kMips64r6) {
if (rs_reg >= rt_reg) { // BNVC
bool condition = is_int32(rs) && is_int32(rt) && is_int32(rs + rt);
BranchCompactHelper(condition, 16);
} else {
if (rs_reg == 0) { // BNEZALC
BranchAndLinkCompactHelper(rt != 0, 16);
} else { // BNEC
BranchCompactHelper(rt != rs, 16);
}
}
}
break;
// ------------- Arithmetic instructions.
case ADDIU: {
int32_t alu32_out = static_cast<int32_t>(rs + se_imm16);
// Sign-extend result of 32bit operation into 64bit register.
SetResult(rt_reg, static_cast<int64_t>(alu32_out));
break;
}
case DADDIU:
SetResult(rt_reg, rs + se_imm16);
break;
case SLTI:
SetResult(rt_reg, rs < se_imm16 ? 1 : 0);
break;
case SLTIU:
SetResult(rt_reg, rs_u < static_cast<uint64_t>(se_imm16) ? 1 : 0);
break;
case ANDI:
SetResult(rt_reg, rs & oe_imm16);
break;
case ORI:
SetResult(rt_reg, rs | oe_imm16);
break;
case XORI:
SetResult(rt_reg, rs ^ oe_imm16);
break;
case LUI:
if (rs_reg != 0) {
// AUI instruction.
DCHECK_EQ(kArchVariant, kMips64r6);
int32_t alu32_out = static_cast<int32_t>(rs + (se_imm16 << 16));
SetResult(rt_reg, static_cast<int64_t>(alu32_out));
} else {
// LUI instruction.
int32_t alu32_out = static_cast<int32_t>(oe_imm16 << 16);
// Sign-extend result of 32bit operation into 64bit register.
SetResult(rt_reg, static_cast<int64_t>(alu32_out));
}
break;
case DAUI:
DCHECK_EQ(kArchVariant, kMips64r6);
DCHECK_NE(rs_reg, 0);
SetResult(rt_reg, rs + (se_imm16 << 16));
break;
// ------------- Memory instructions.
case LB:
set_register(rt_reg, ReadB(rs + se_imm16));
break;
case LH:
set_register(rt_reg, ReadH(rs + se_imm16, instr_.instr()));
break;
case LWL: {
local_monitor_.NotifyLoad();
// al_offset is offset of the effective address within an aligned word.
uint8_t al_offset = (rs + se_imm16) & kInt32AlignmentMask;
uint8_t byte_shift = kInt32AlignmentMask - al_offset;
uint32_t mask = (1 << byte_shift * 8) - 1;
addr = rs + se_imm16 - al_offset;
int32_t val = ReadW(addr, instr_.instr());
val <<= byte_shift * 8;
val |= rt & mask;
set_register(rt_reg, static_cast<int64_t>(val));
break;
}
case LW:
set_register(rt_reg, ReadW(rs + se_imm16, instr_.instr()));
break;
case LWU:
set_register(rt_reg, ReadWU(rs + se_imm16, instr_.instr()));
break;
case LD:
set_register(rt_reg, Read2W(rs + se_imm16, instr_.instr()));
break;
case LBU:
set_register(rt_reg, ReadBU(rs + se_imm16));
break;
case LHU:
set_register(rt_reg, ReadHU(rs + se_imm16, instr_.instr()));
break;
case LWR: {
// al_offset is offset of the effective address within an aligned word.
uint8_t al_offset = (rs + se_imm16) & kInt32AlignmentMask;
uint8_t byte_shift = kInt32AlignmentMask - al_offset;
uint32_t mask = al_offset ? (~0 << (byte_shift + 1) * 8) : 0;
addr = rs + se_imm16 - al_offset;
alu_out = ReadW(addr, instr_.instr());
alu_out = static_cast<uint32_t>(alu_out) >> al_offset * 8;
alu_out |= rt & mask;
set_register(rt_reg, alu_out);
break;
}
case LDL: {
// al_offset is offset of the effective address within an aligned word.
uint8_t al_offset = (rs + se_imm16) & kInt64AlignmentMask;
uint8_t byte_shift = kInt64AlignmentMask - al_offset;
uint64_t mask = (1UL << byte_shift * 8) - 1;
addr = rs + se_imm16 - al_offset;
alu_out = Read2W(addr, instr_.instr());
alu_out <<= byte_shift * 8;
alu_out |= rt & mask;
set_register(rt_reg, alu_out);
break;
}
case LDR: {
// al_offset is offset of the effective address within an aligned word.
uint8_t al_offset = (rs + se_imm16) & kInt64AlignmentMask;
uint8_t byte_shift = kInt64AlignmentMask - al_offset;
uint64_t mask = al_offset ? (~0UL << (byte_shift + 1) * 8) : 0UL;
addr = rs + se_imm16 - al_offset;
alu_out = Read2W(addr, instr_.instr());
alu_out = alu_out >> al_offset * 8;
alu_out |= rt & mask;
set_register(rt_reg, alu_out);
break;
}
case SB:
WriteB(rs + se_imm16, static_cast<int8_t>(rt));
break;
case SH:
WriteH(rs + se_imm16, static_cast<uint16_t>(rt), instr_.instr());
break;
case SWL: {
uint8_t al_offset = (rs + se_imm16) & kInt32AlignmentMask;
uint8_t byte_shift = kInt32AlignmentMask - al_offset;
uint32_t mask = byte_shift ? (~0 << (al_offset + 1) * 8) : 0;
addr = rs + se_imm16 - al_offset;
uint64_t mem_value = ReadW(addr, instr_.instr()) & mask;
mem_value |= static_cast<uint32_t>(rt) >> byte_shift * 8;
WriteW(addr, static_cast<int32_t>(mem_value), instr_.instr());
break;
}
case SW:
WriteW(rs + se_imm16, static_cast<int32_t>(rt), instr_.instr());
break;
case SD:
Write2W(rs + se_imm16, rt, instr_.instr());
break;
case SWR: {
uint8_t al_offset = (rs + se_imm16) & kInt32AlignmentMask;
uint32_t mask = (1 << al_offset * 8) - 1;
addr = rs + se_imm16 - al_offset;
uint64_t mem_value = ReadW(addr, instr_.instr());
mem_value = (rt << al_offset * 8) | (mem_value & mask);
WriteW(addr, static_cast<int32_t>(mem_value), instr_.instr());
break;
}
case SDL: {
uint8_t al_offset = (rs + se_imm16) & kInt64AlignmentMask;
uint8_t byte_shift = kInt64AlignmentMask - al_offset;
uint64_t mask = byte_shift ? (~0UL << (al_offset + 1) * 8) : 0;
addr = rs + se_imm16 - al_offset;
uint64_t mem_value = Read2W(addr, instr_.instr()) & mask;
mem_value |= static_cast<uint64_t>(rt) >> byte_shift * 8;
Write2W(addr, mem_value, instr_.instr());
break;
}
case SDR: {
uint8_t al_offset = (rs + se_imm16) & kInt64AlignmentMask;
uint64_t mask = (1UL << al_offset * 8) - 1;
addr = rs + se_imm16 - al_offset;
uint64_t mem_value = Read2W(addr, instr_.instr());
mem_value = (rt << al_offset * 8) | (mem_value & mask);
Write2W(addr, mem_value, instr_.instr());
break;
}
case LL: {
DCHECK(kArchVariant != kMips64r6);
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
addr = rs + se_imm16;
set_register(rt_reg, ReadW(addr, instr_.instr()));
local_monitor_.NotifyLoadLinked(addr, TransactionSize::Word);
GlobalMonitor::Get()->NotifyLoadLinked_Locked(addr,
&global_monitor_thread_);
break;
}
case SC: {
DCHECK(kArchVariant != kMips64r6);
addr = rs + se_imm16;
WriteConditionalW(addr, static_cast<int32_t>(rt), instr_.instr(), rt_reg);
break;
}
case LLD: {
DCHECK(kArchVariant != kMips64r6);
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
addr = rs + se_imm16;
set_register(rt_reg, Read2W(addr, instr_.instr()));
local_monitor_.NotifyLoadLinked(addr, TransactionSize::DoubleWord);
GlobalMonitor::Get()->NotifyLoadLinked_Locked(addr,
&global_monitor_thread_);
break;
}
case SCD: {
DCHECK(kArchVariant != kMips64r6);
addr = rs + se_imm16;
WriteConditional2W(addr, rt, instr_.instr(), rt_reg);
break;
}
case LWC1:
set_fpu_register(ft_reg, kFPUInvalidResult); // Trash upper 32 bits.
set_fpu_register_word(ft_reg,
ReadW(rs + se_imm16, instr_.instr(), FLOAT_DOUBLE));
break;
case LDC1:
set_fpu_register_double(ft_reg, ReadD(rs + se_imm16, instr_.instr()));
TraceMemRd(addr, get_fpu_register(ft_reg), DOUBLE);
break;
case SWC1: {
int32_t alu_out_32 = static_cast<int32_t>(get_fpu_register(ft_reg));
WriteW(rs + se_imm16, alu_out_32, instr_.instr());
break;
}
case SDC1:
WriteD(rs + se_imm16, get_fpu_register_double(ft_reg), instr_.instr());
TraceMemWr(rs + se_imm16, get_fpu_register(ft_reg), DWORD);
break;
// ------------- PC-Relative instructions.
case PCREL: {
// rt field: checking 5-bits.
int32_t imm21 = instr_.Imm21Value();
int64_t current_pc = get_pc();
uint8_t rt = (imm21 >> kImm16Bits);
switch (rt) {
case ALUIPC:
addr = current_pc + (se_imm16 << 16);
alu_out = static_cast<int64_t>(~0x0FFFF) & addr;
break;
case AUIPC:
alu_out = current_pc + (se_imm16 << 16);
break;
default: {
int32_t imm19 = instr_.Imm19Value();
// rt field: checking the most significant 3-bits.
rt = (imm21 >> kImm18Bits);
switch (rt) {
case LDPC:
addr =
(current_pc & static_cast<int64_t>(~0x7)) + (se_imm18 << 3);
alu_out = Read2W(addr, instr_.instr());
break;
default: {
// rt field: checking the most significant 2-bits.
rt = (imm21 >> kImm19Bits);
switch (rt) {
case LWUPC: {
// Set sign.
imm19 <<= (kOpcodeBits + kRsBits + 2);
imm19 >>= (kOpcodeBits + kRsBits + 2);
addr = current_pc + (imm19 << 2);
alu_out = ReadWU(addr, instr_.instr());
break;
}
case LWPC: {
// Set sign.
imm19 <<= (kOpcodeBits + kRsBits + 2);
imm19 >>= (kOpcodeBits + kRsBits + 2);
addr = current_pc + (imm19 << 2);
alu_out = ReadW(addr, instr_.instr());
break;
}
case ADDIUPC: {
int64_t se_imm19 =
imm19 | ((imm19 & 0x40000) ? 0xFFFFFFFFFFF80000 : 0);
alu_out = current_pc + (se_imm19 << 2);
break;
}
default:
UNREACHABLE();
break;
}
break;
}
}
break;
}
}
SetResult(rs_reg, alu_out);
break;
}
case SPECIAL3: {
switch (instr_.FunctionFieldRaw()) {
case LL_R6: {
DCHECK_EQ(kArchVariant, kMips64r6);
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
int64_t base = get_register(instr_.BaseValue());
int32_t offset9 = instr_.Imm9Value();
addr = base + offset9;
DCHECK_EQ(addr & 0x3, 0);
set_register(rt_reg, ReadW(addr, instr_.instr()));
local_monitor_.NotifyLoadLinked(addr, TransactionSize::Word);
GlobalMonitor::Get()->NotifyLoadLinked_Locked(
addr, &global_monitor_thread_);
break;
}
case LLD_R6: {
DCHECK_EQ(kArchVariant, kMips64r6);
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
int64_t base = get_register(instr_.BaseValue());
int32_t offset9 = instr_.Imm9Value();
addr = base + offset9;
DCHECK_EQ(addr & kPointerAlignmentMask, 0);
set_register(rt_reg, Read2W(addr, instr_.instr()));
local_monitor_.NotifyLoadLinked(addr, TransactionSize::DoubleWord);
GlobalMonitor::Get()->NotifyLoadLinked_Locked(
addr, &global_monitor_thread_);
break;
}
case SC_R6: {
DCHECK_EQ(kArchVariant, kMips64r6);
int64_t base = get_register(instr_.BaseValue());
int32_t offset9 = instr_.Imm9Value();
addr = base + offset9;
DCHECK_EQ(addr & 0x3, 0);
WriteConditionalW(addr, static_cast<int32_t>(rt), instr_.instr(),
rt_reg);
break;
}
case SCD_R6: {
DCHECK_EQ(kArchVariant, kMips64r6);
int64_t base = get_register(instr_.BaseValue());
int32_t offset9 = instr_.Imm9Value();
addr = base + offset9;
DCHECK_EQ(addr & kPointerAlignmentMask, 0);
WriteConditional2W(addr, rt, instr_.instr(), rt_reg);
break;
}
default:
UNREACHABLE();
}
break;
}
case MSA:
switch (instr_.MSAMinorOpcodeField()) {
case kMsaMinorI8:
DecodeTypeMsaI8();
break;
case kMsaMinorI5:
DecodeTypeMsaI5();
break;
case kMsaMinorI10:
DecodeTypeMsaI10();
break;
case kMsaMinorELM:
DecodeTypeMsaELM();
break;
case kMsaMinorBIT:
DecodeTypeMsaBIT();
break;
case kMsaMinorMI10:
DecodeTypeMsaMI10();
break;
default:
UNREACHABLE();
break;
}
break;
default:
UNREACHABLE();
}
if (execute_branch_delay_instruction) {
// Execute branch delay slot
// We don't check for end_sim_pc. First it should not be met as the current
// pc is valid. Secondly a jump should always execute its branch delay slot.
Instruction* branch_delay_instr =
reinterpret_cast<Instruction*>(get_pc() + kInstrSize);
BranchDelayInstructionDecode(branch_delay_instr);
}
// If needed update pc after the branch delay execution.
if (next_pc != bad_ra) {
set_pc(next_pc);
}
}
// Type 3: instructions using a 26 bytes immediate. (e.g. j, jal).
void Simulator::DecodeTypeJump() {
SimInstruction simInstr = instr_;
// Get current pc.
int64_t current_pc = get_pc();
// Get unchanged bits of pc.
int64_t pc_high_bits = current_pc & 0xFFFFFFFFF0000000;
// Next pc.
int64_t next_pc = pc_high_bits | (simInstr.Imm26Value() << 2);
// Execute branch delay slot.
// We don't check for end_sim_pc. First it should not be met as the current pc
// is valid. Secondly a jump should always execute its branch delay slot.
Instruction* branch_delay_instr =
reinterpret_cast<Instruction*>(current_pc + kInstrSize);
BranchDelayInstructionDecode(branch_delay_instr);
// Update pc and ra if necessary.
// Do this after the branch delay execution.
if (simInstr.IsLinkingInstruction()) {
set_register(31, current_pc + 2 * kInstrSize);
}
set_pc(next_pc);
pc_modified_ = true;
}
// Executes the current instruction.
void Simulator::InstructionDecode(Instruction* instr) {
if (v8::internal::FLAG_check_icache) {
CheckICache(i_cache(), instr);
}
pc_modified_ = false;
v8::internal::EmbeddedVector<char, 256> buffer;
if (::v8::internal::FLAG_trace_sim) {
SNPrintF(trace_buf_, " ");
disasm::NameConverter converter;
disasm::Disassembler dasm(converter);
// Use a reasonably large buffer.
dasm.InstructionDecode(buffer, reinterpret_cast<byte*>(instr));
}
instr_ = instr;
switch (instr_.InstructionType()) {
case Instruction::kRegisterType:
DecodeTypeRegister();
break;
case Instruction::kImmediateType:
DecodeTypeImmediate();
break;
case Instruction::kJumpType:
DecodeTypeJump();
break;
default:
UNSUPPORTED();
}
if (::v8::internal::FLAG_trace_sim) {
PrintF(" 0x%08" PRIxPTR " %-44s %s\n",
reinterpret_cast<intptr_t>(instr), buffer.begin(),
trace_buf_.begin());
}
if (!pc_modified_) {
set_register(pc, reinterpret_cast<int64_t>(instr) + kInstrSize);
}
}
void Simulator::Execute() {
// Get the PC to simulate. Cannot use the accessor here as we need the
// raw PC value and not the one used as input to arithmetic instructions.
int64_t program_counter = get_pc();
if (::v8::internal::FLAG_stop_sim_at == 0) {
// Fast version of the dispatch loop without checking whether the simulator
// should be stopping at a particular executed instruction.
while (program_counter != end_sim_pc) {
Instruction* instr = reinterpret_cast<Instruction*>(program_counter);
icount_++;
InstructionDecode(instr);
program_counter = get_pc();
}
} else {
// FLAG_stop_sim_at is at the non-default value. Stop in the debugger when
// we reach the particular instruction count.
while (program_counter != end_sim_pc) {
Instruction* instr = reinterpret_cast<Instruction*>(program_counter);
icount_++;
if (icount_ == static_cast<int64_t>(::v8::internal::FLAG_stop_sim_at)) {
MipsDebugger dbg(this);
dbg.Debug();
} else {
InstructionDecode(instr);
}
program_counter = get_pc();
}
}
}
void Simulator::CallInternal(Address entry) {
// Adjust JS-based stack limit to C-based stack limit.
isolate_->stack_guard()->AdjustStackLimitForSimulator();
// Prepare to execute the code at entry.
set_register(pc, static_cast<int64_t>(entry));
// Put down marker for end of simulation. The simulator will stop simulation
// when the PC reaches this value. By saving the "end simulation" value into
// the LR the simulation stops when returning to this call point.
set_register(ra, end_sim_pc);
// Remember the values of callee-saved registers.
// The code below assumes that r9 is not used as sb (static base) in
// simulator code and therefore is regarded as a callee-saved register.
int64_t s0_val = get_register(s0);
int64_t s1_val = get_register(s1);
int64_t s2_val = get_register(s2);
int64_t s3_val = get_register(s3);
int64_t s4_val = get_register(s4);
int64_t s5_val = get_register(s5);
int64_t s6_val = get_register(s6);
int64_t s7_val = get_register(s7);
int64_t gp_val = get_register(gp);
int64_t sp_val = get_register(sp);
int64_t fp_val = get_register(fp);
// Set up the callee-saved registers with a known value. To be able to check
// that they are preserved properly across JS execution.
int64_t callee_saved_value = icount_;
set_register(s0, callee_saved_value);
set_register(s1, callee_saved_value);
set_register(s2, callee_saved_value);
set_register(s3, callee_saved_value);
set_register(s4, callee_saved_value);
set_register(s5, callee_saved_value);
set_register(s6, callee_saved_value);
set_register(s7, callee_saved_value);
set_register(gp, callee_saved_value);
set_register(fp, callee_saved_value);
// Start the simulation.
Execute();
// Check that the callee-saved registers have been preserved.
CHECK_EQ(callee_saved_value, get_register(s0));
CHECK_EQ(callee_saved_value, get_register(s1));
CHECK_EQ(callee_saved_value, get_register(s2));
CHECK_EQ(callee_saved_value, get_register(s3));
CHECK_EQ(callee_saved_value, get_register(s4));
CHECK_EQ(callee_saved_value, get_register(s5));
CHECK_EQ(callee_saved_value, get_register(s6));
CHECK_EQ(callee_saved_value, get_register(s7));
CHECK_EQ(callee_saved_value, get_register(gp));
CHECK_EQ(callee_saved_value, get_register(fp));
// Restore callee-saved registers with the original value.
set_register(s0, s0_val);
set_register(s1, s1_val);
set_register(s2, s2_val);
set_register(s3, s3_val);
set_register(s4, s4_val);
set_register(s5, s5_val);
set_register(s6, s6_val);
set_register(s7, s7_val);
set_register(gp, gp_val);
set_register(sp, sp_val);
set_register(fp, fp_val);
}
intptr_t Simulator::CallImpl(Address entry, int argument_count,
const intptr_t* arguments) {
constexpr int kRegisterPassedArguments = 8;
// Set up arguments.
// First four arguments passed in registers in both ABI's.
int reg_arg_count = std::min(kRegisterPassedArguments, argument_count);
if (reg_arg_count > 0) set_register(a0, arguments[0]);
if (reg_arg_count > 1) set_register(a1, arguments[1]);
if (reg_arg_count > 2) set_register(a2, arguments[2]);
if (reg_arg_count > 3) set_register(a3, arguments[3]);
// Up to eight arguments passed in registers in N64 ABI.
// TODO(plind): N64 ABI calls these regs a4 - a7. Clarify this.
if (reg_arg_count > 4) set_register(a4, arguments[4]);
if (reg_arg_count > 5) set_register(a5, arguments[5]);
if (reg_arg_count > 6) set_register(a6, arguments[6]);
if (reg_arg_count > 7) set_register(a7, arguments[7]);
// Remaining arguments passed on stack.
int64_t original_stack = get_register(sp);
// Compute position of stack on entry to generated code.
int stack_args_count = argument_count - reg_arg_count;
int stack_args_size = stack_args_count * sizeof(*arguments) + kCArgsSlotsSize;
int64_t entry_stack = original_stack - stack_args_size;
if (base::OS::ActivationFrameAlignment() != 0) {
entry_stack &= -base::OS::ActivationFrameAlignment();
}
// Store remaining arguments on stack, from low to high memory.
intptr_t* stack_argument = reinterpret_cast<intptr_t*>(entry_stack);
memcpy(stack_argument + kCArgSlotCount, arguments + reg_arg_count,
stack_args_count * sizeof(*arguments));
set_register(sp, entry_stack);
CallInternal(entry);
// Pop stack passed arguments.
CHECK_EQ(entry_stack, get_register(sp));
set_register(sp, original_stack);
return get_register(v0);
}
double Simulator::CallFP(Address entry, double d0, double d1) {
if (!IsMipsSoftFloatABI) {
const FPURegister fparg2 = f13;
set_fpu_register_double(f12, d0);
set_fpu_register_double(fparg2, d1);
} else {
int buffer[2];
DCHECK(sizeof(buffer[0]) * 2 == sizeof(d0));
memcpy(buffer, &d0, sizeof(d0));
set_dw_register(a0, buffer);
memcpy(buffer, &d1, sizeof(d1));
set_dw_register(a2, buffer);
}
CallInternal(entry);
if (!IsMipsSoftFloatABI) {
return get_fpu_register_double(f0);
} else {
return get_double_from_register_pair(v0);
}
}
uintptr_t Simulator::PushAddress(uintptr_t address) {
int64_t new_sp = get_register(sp) - sizeof(uintptr_t);
uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(new_sp);
*stack_slot = address;
set_register(sp, new_sp);
return new_sp;
}
uintptr_t Simulator::PopAddress() {
int64_t current_sp = get_register(sp);
uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp);
uintptr_t address = *stack_slot;
set_register(sp, current_sp + sizeof(uintptr_t));
return address;
}
Simulator::LocalMonitor::LocalMonitor()
: access_state_(MonitorAccess::Open),
tagged_addr_(0),
size_(TransactionSize::None) {}
void Simulator::LocalMonitor::Clear() {
access_state_ = MonitorAccess::Open;
tagged_addr_ = 0;
size_ = TransactionSize::None;
}
void Simulator::LocalMonitor::NotifyLoad() {
if (access_state_ == MonitorAccess::RMW) {
// A non linked load could clear the local monitor. As a result, it's
// most strict to unconditionally clear the local monitor on load.
Clear();
}
}
void Simulator::LocalMonitor::NotifyLoadLinked(uintptr_t addr,
TransactionSize size) {
access_state_ = MonitorAccess::RMW;
tagged_addr_ = addr;
size_ = size;
}
void Simulator::LocalMonitor::NotifyStore() {
if (access_state_ == MonitorAccess::RMW) {
// A non exclusive store could clear the local monitor. As a result, it's
// most strict to unconditionally clear the local monitor on store.
Clear();
}
}
bool Simulator::LocalMonitor::NotifyStoreConditional(uintptr_t addr,
TransactionSize size) {
if (access_state_ == MonitorAccess::RMW) {
if (addr == tagged_addr_ && size_ == size) {
Clear();
return true;
} else {
return false;
}
} else {
DCHECK(access_state_ == MonitorAccess::Open);
return false;
}
}
Simulator::GlobalMonitor::LinkedAddress::LinkedAddress()
: access_state_(MonitorAccess::Open),
tagged_addr_(0),
next_(nullptr),
prev_(nullptr),
failure_counter_(0) {}
void Simulator::GlobalMonitor::LinkedAddress::Clear_Locked() {
access_state_ = MonitorAccess::Open;
tagged_addr_ = 0;
}
void Simulator::GlobalMonitor::LinkedAddress::NotifyLoadLinked_Locked(
uintptr_t addr) {
access_state_ = MonitorAccess::RMW;
tagged_addr_ = addr;
}
void Simulator::GlobalMonitor::LinkedAddress::NotifyStore_Locked() {
if (access_state_ == MonitorAccess::RMW) {
// A non exclusive store could clear the global monitor. As a result, it's
// most strict to unconditionally clear global monitors on store.
Clear_Locked();
}
}
bool Simulator::GlobalMonitor::LinkedAddress::NotifyStoreConditional_Locked(
uintptr_t addr, bool is_requesting_thread) {
if (access_state_ == MonitorAccess::RMW) {
if (is_requesting_thread) {
if (addr == tagged_addr_) {
Clear_Locked();
// Introduce occasional sc/scd failures. This is to simulate the
// behavior of hardware, which can randomly fail due to background
// cache evictions.
if (failure_counter_++ >= kMaxFailureCounter) {
failure_counter_ = 0;
return false;
} else {
return true;
}
}
} else if ((addr & kExclusiveTaggedAddrMask) ==
(tagged_addr_ & kExclusiveTaggedAddrMask)) {
// Check the masked addresses when responding to a successful lock by
// another thread so the implementation is more conservative (i.e. the
// granularity of locking is as large as possible.)
Clear_Locked();
return false;
}
}
return false;
}
void Simulator::GlobalMonitor::NotifyLoadLinked_Locked(
uintptr_t addr, LinkedAddress* linked_address) {
linked_address->NotifyLoadLinked_Locked(addr);
PrependProcessor_Locked(linked_address);
}
void Simulator::GlobalMonitor::NotifyStore_Locked(
LinkedAddress* linked_address) {
// Notify each thread of the store operation.
for (LinkedAddress* iter = head_; iter; iter = iter->next_) {
iter->NotifyStore_Locked();
}
}
bool Simulator::GlobalMonitor::NotifyStoreConditional_Locked(
uintptr_t addr, LinkedAddress* linked_address) {
DCHECK(IsProcessorInLinkedList_Locked(linked_address));
if (linked_address->NotifyStoreConditional_Locked(addr, true)) {
// Notify the other processors that this StoreConditional succeeded.
for (LinkedAddress* iter = head_; iter; iter = iter->next_) {
if (iter != linked_address) {
iter->NotifyStoreConditional_Locked(addr, false);
}
}
return true;
} else {
return false;
}
}
bool Simulator::GlobalMonitor::IsProcessorInLinkedList_Locked(
LinkedAddress* linked_address) const {
return head_ == linked_address || linked_address->next_ ||
linked_address->prev_;
}
void Simulator::GlobalMonitor::PrependProcessor_Locked(
LinkedAddress* linked_address) {
if (IsProcessorInLinkedList_Locked(linked_address)) {
return;
}
if (head_) {
head_->prev_ = linked_address;
}
linked_address->prev_ = nullptr;
linked_address->next_ = head_;
head_ = linked_address;
}
void Simulator::GlobalMonitor::RemoveLinkedAddress(
LinkedAddress* linked_address) {
base::MutexGuard lock_guard(&mutex);
if (!IsProcessorInLinkedList_Locked(linked_address)) {
return;
}
if (linked_address->prev_) {
linked_address->prev_->next_ = linked_address->next_;
} else {
head_ = linked_address->next_;
}
if (linked_address->next_) {
linked_address->next_->prev_ = linked_address->prev_;
}
linked_address->prev_ = nullptr;
linked_address->next_ = nullptr;
}
#undef SScanF
} // namespace internal
} // namespace v8
#endif // USE_SIMULATOR
```
|
```c
/**
* @license Apache-2.0
*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
#include "stdlib/math/base/special/asecf.h"
#include "stdlib/math/base/special/acosf.h"
/**
* Computes the inverse (arc) secant of a single-precision floating-point number.
*
* @param x input value
* @return output value
*
* @example
* float out = stdlib_base_asecf( 1.0f );
* // returns 0.0f
*/
float stdlib_base_asecf( const float x ) {
return stdlib_base_acosf( 1.0f / x );
}
```
|
```php
<?php
namespace Illuminate\Cache;
use Aws\DynamoDb\DynamoDbClient;
use Closure;
use Illuminate\Contracts\Cache\Factory as FactoryContract;
use Illuminate\Contracts\Cache\Store;
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Support\Arr;
use InvalidArgumentException;
/**
* @mixin \Illuminate\Contracts\Cache\Repository
*/
class CacheManager implements FactoryContract
{
/**
* The application instance.
*
* @var \Illuminate\Contracts\Foundation\Application
*/
protected $app;
/**
* The array of resolved cache stores.
*
* @var array
*/
protected $stores = [];
/**
* The registered custom driver creators.
*
* @var array
*/
protected $customCreators = [];
/**
* Create a new Cache manager instance.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
public function __construct($app)
{
$this->app = $app;
}
/**
* Get a cache store instance by name, wrapped in a repository.
*
* @param string|null $name
* @return \Illuminate\Contracts\Cache\Repository
*/
public function store($name = null)
{
$name = $name ?: $this->getDefaultDriver();
return $this->stores[$name] = $this->get($name);
}
/**
* Get a cache driver instance.
*
* @param string|null $driver
* @return \Illuminate\Contracts\Cache\Repository
*/
public function driver($driver = null)
{
return $this->store($driver);
}
/**
* Attempt to get the store from the local cache.
*
* @param string $name
* @return \Illuminate\Contracts\Cache\Repository
*/
protected function get($name)
{
return $this->stores[$name] ?? $this->resolve($name);
}
/**
* Resolve the given store.
*
* @param string $name
* @return \Illuminate\Contracts\Cache\Repository
*
* @throws \InvalidArgumentException
*/
protected function resolve($name)
{
$config = $this->getConfig($name);
if (is_null($config)) {
throw new InvalidArgumentException("Cache store [{$name}] is not defined.");
}
if (isset($this->customCreators[$config['driver']])) {
return $this->callCustomCreator($config);
} else {
$driverMethod = 'create'.ucfirst($config['driver']).'Driver';
if (method_exists($this, $driverMethod)) {
return $this->{$driverMethod}($config);
} else {
throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported.");
}
}
}
/**
* Call a custom driver creator.
*
* @param array $config
* @return mixed
*/
protected function callCustomCreator(array $config)
{
return $this->customCreators[$config['driver']]($this->app, $config);
}
/**
* Create an instance of the APC cache driver.
*
* @param array $config
* @return \Illuminate\Cache\Repository
*/
protected function createApcDriver(array $config)
{
$prefix = $this->getPrefix($config);
return $this->repository(new ApcStore(new ApcWrapper, $prefix));
}
/**
* Create an instance of the array cache driver.
*
* @param array $config
* @return \Illuminate\Cache\Repository
*/
protected function createArrayDriver(array $config)
{
return $this->repository(new ArrayStore($config['serialize'] ?? false));
}
/**
* Create an instance of the file cache driver.
*
* @param array $config
* @return \Illuminate\Cache\Repository
*/
protected function createFileDriver(array $config)
{
return $this->repository(new FileStore($this->app['files'], $config['path'], $config['permission'] ?? null));
}
/**
* Create an instance of the Memcached cache driver.
*
* @param array $config
* @return \Illuminate\Cache\Repository
*/
protected function createMemcachedDriver(array $config)
{
$prefix = $this->getPrefix($config);
$memcached = $this->app['memcached.connector']->connect(
$config['servers'],
$config['persistent_id'] ?? null,
$config['options'] ?? [],
array_filter($config['sasl'] ?? [])
);
return $this->repository(new MemcachedStore($memcached, $prefix));
}
/**
* Create an instance of the Null cache driver.
*
* @return \Illuminate\Cache\Repository
*/
protected function createNullDriver()
{
return $this->repository(new NullStore);
}
/**
* Create an instance of the Redis cache driver.
*
* @param array $config
* @return \Illuminate\Cache\Repository
*/
protected function createRedisDriver(array $config)
{
$redis = $this->app['redis'];
$connection = $config['connection'] ?? 'default';
$store = new RedisStore($redis, $this->getPrefix($config), $connection);
return $this->repository(
$store->setLockConnection($config['lock_connection'] ?? $connection)
);
}
/**
* Create an instance of the database cache driver.
*
* @param array $config
* @return \Illuminate\Cache\Repository
*/
protected function createDatabaseDriver(array $config)
{
$connection = $this->app['db']->connection($config['connection'] ?? null);
$store = new DatabaseStore(
$connection,
$config['table'],
$this->getPrefix($config),
$config['lock_table'] ?? 'cache_locks',
$config['lock_lottery'] ?? [2, 100]
);
return $this->repository($store->setLockConnection(
$this->app['db']->connection($config['lock_connection'] ?? $config['connection'] ?? null)
));
}
/**
* Create an instance of the DynamoDB cache driver.
*
* @param array $config
* @return \Illuminate\Cache\Repository
*/
protected function createDynamodbDriver(array $config)
{
$client = $this->newDynamodbClient($config);
return $this->repository(
new DynamoDbStore(
$client,
$config['table'],
$config['attributes']['key'] ?? 'key',
$config['attributes']['value'] ?? 'value',
$config['attributes']['expiration'] ?? 'expires_at',
$this->getPrefix($config)
)
);
}
/**
* Create new DynamoDb Client instance.
*
* @return DynamoDbClient
*/
protected function newDynamodbClient(array $config)
{
$dynamoConfig = [
'region' => $config['region'],
'version' => 'latest',
'endpoint' => $config['endpoint'] ?? null,
];
if (isset($config['key']) && isset($config['secret'])) {
$dynamoConfig['credentials'] = Arr::only(
$config, ['key', 'secret', 'token']
);
}
return new DynamoDbClient($dynamoConfig);
}
/**
* Create a new cache repository with the given implementation.
*
* @param \Illuminate\Contracts\Cache\Store $store
* @return \Illuminate\Cache\Repository
*/
public function repository(Store $store)
{
return tap(new Repository($store), function ($repository) {
$this->setEventDispatcher($repository);
});
}
/**
* Set the event dispatcher on the given repository instance.
*
* @param \Illuminate\Cache\Repository $repository
* @return void
*/
protected function setEventDispatcher(Repository $repository)
{
if (! $this->app->bound(DispatcherContract::class)) {
return;
}
$repository->setEventDispatcher(
$this->app[DispatcherContract::class]
);
}
/**
* Re-set the event dispatcher on all resolved cache repositories.
*
* @return void
*/
public function refreshEventDispatcher()
{
array_map([$this, 'setEventDispatcher'], $this->stores);
}
/**
* Get the cache prefix.
*
* @param array $config
* @return string
*/
protected function getPrefix(array $config)
{
return $config['prefix'] ?? $this->app['config']['cache.prefix'];
}
/**
* Get the cache connection configuration.
*
* @param string $name
* @return array
*/
protected function getConfig($name)
{
if (! is_null($name) && $name !== 'null') {
return $this->app['config']["cache.stores.{$name}"];
}
return ['driver' => 'null'];
}
/**
* Get the default cache driver name.
*
* @return string
*/
public function getDefaultDriver()
{
return $this->app['config']['cache.default'];
}
/**
* Set the default cache driver name.
*
* @param string $name
* @return void
*/
public function setDefaultDriver($name)
{
$this->app['config']['cache.default'] = $name;
}
/**
* Unset the given driver instances.
*
* @param array|string|null $name
* @return $this
*/
public function forgetDriver($name = null)
{
$name = $name ?? $this->getDefaultDriver();
foreach ((array) $name as $cacheName) {
if (isset($this->stores[$cacheName])) {
unset($this->stores[$cacheName]);
}
}
return $this;
}
/**
* Disconnect the given driver and remove from local cache.
*
* @param string|null $name
* @return void
*/
public function purge($name = null)
{
$name = $name ?? $this->getDefaultDriver();
unset($this->stores[$name]);
}
/**
* Register a custom driver creator Closure.
*
* @param string $driver
* @param \Closure $callback
* @return $this
*/
public function extend($driver, Closure $callback)
{
$this->customCreators[$driver] = $callback->bindTo($this, $this);
return $this;
}
/**
* Dynamically call the default driver instance.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
return $this->store()->$method(...$parameters);
}
}
```
|
Destiny is a 2014 historical fiction novel written by Don Brown. It is the prequel to Browns Navy Justice Series, perhaps considered to be Brown's signature literary series. Although the novel was the first novel written in the series, it was also the most recently released. Set in World War II, the novel's protagonist is Walter Brewer, the grandfather of Navy Justice Series hero, JAG Officer Lieutenant Zack Brewer. The storyline climaxes in and around the events surrounding the Battle of Normandy. Although the novel was penned in 2003, it was released in 2014, according to Brown, making it the last in the series to be released sequentially, but the first written, chronologically.
References
2014 American novels
Novels set during World War II
Fiction set in 1944
Operation Overlord
Novels set in Normandy
|
```go
package systemartifact
import (
"context"
"errors"
"fmt"
"os"
"strings"
"testing"
"time"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/lib/orm"
"github.com/goharbor/harbor/src/lib/q"
"github.com/goharbor/harbor/src/pkg/systemartifact/model"
ormtesting "github.com/goharbor/harbor/src/testing/lib/orm"
"github.com/goharbor/harbor/src/testing/mock"
registrytesting "github.com/goharbor/harbor/src/testing/pkg/registry"
"github.com/goharbor/harbor/src/testing/pkg/systemartifact/cleanup"
sysartifactdaotesting "github.com/goharbor/harbor/src/testing/pkg/systemartifact/dao"
)
type ManagerTestSuite struct {
suite.Suite
regCli *registrytesting.Client
dao *sysartifactdaotesting.DAO
mgr *systemArtifactManager
cleanupCriteria *cleanup.Selector
}
func (suite *ManagerTestSuite) SetupSuite() {
}
func (suite *ManagerTestSuite) SetupTest() {
suite.regCli = ®istrytesting.Client{}
suite.dao = &sysartifactdaotesting.DAO{}
suite.cleanupCriteria = &cleanup.Selector{}
suite.mgr = &systemArtifactManager{
regCli: suite.regCli,
dao: suite.dao,
defaultCleanupCriterion: suite.cleanupCriteria,
cleanupCriteria: make(map[string]Selector),
}
}
func (suite *ManagerTestSuite) TestCreate() {
sa := model.SystemArtifact{
Repository: "test_repo",
Digest: "test_digest",
Size: int64(100),
Vendor: "test_vendor",
Type: "test_type",
CreateTime: time.Now(),
ExtraAttrs: "",
}
suite.dao.On("Create", mock.Anything, &sa, mock.Anything).Return(int64(1), nil).Once()
suite.regCli.On("PushBlob", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Once()
reader := strings.NewReader("test data string")
id, err := suite.mgr.Create(orm.NewContext(nil, &ormtesting.FakeOrmer{}), &sa, reader)
suite.Equalf(int64(1), id, "Expected row to correctly inserted")
suite.NoErrorf(err, "Unexpected error when creating artifact: %v", err)
suite.regCli.AssertCalled(suite.T(), "PushBlob", mock.Anything, mock.Anything, mock.Anything, mock.Anything)
}
func (suite *ManagerTestSuite) TestCreateTimeNotSet() {
sa := model.SystemArtifact{
Repository: "test_repo",
Digest: "test_digest",
Size: int64(100),
Vendor: "test_vendor",
Type: "test_type",
}
suite.dao.On("Create", mock.Anything, &sa, mock.Anything).Return(int64(1), nil).Once()
suite.regCli.On("PushBlob", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Once()
reader := strings.NewReader("test data string")
id, err := suite.mgr.Create(orm.NewContext(nil, &ormtesting.FakeOrmer{}), &sa, reader)
suite.Equalf(int64(1), id, "Expected row to correctly inserted")
suite.NoErrorf(err, "Unexpected error when creating artifact: %v", err)
suite.regCli.AssertCalled(suite.T(), "PushBlob", mock.Anything, mock.Anything, mock.Anything, mock.Anything)
suite.False(sa.CreateTime.IsZero(), "Create time expected to be set")
}
func (suite *ManagerTestSuite) TestCreatePushBlobFails() {
sa := model.SystemArtifact{
Repository: "test_repo",
Digest: "test_digest",
Size: int64(100),
Vendor: "test_vendor",
Type: "test_type",
CreateTime: time.Now(),
ExtraAttrs: "",
}
suite.dao.On("Create", mock.Anything, &sa, mock.Anything).Return(int64(1), nil).Once()
suite.dao.On("Delete", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Once()
suite.regCli.On("PushBlob", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(errors.New("error")).Once()
reader := strings.NewReader("test data string")
id, err := suite.mgr.Create(orm.NewContext(nil, &ormtesting.FakeOrmer{}), &sa, reader)
suite.Equalf(int64(0), id, "Expected no row to be inserted")
suite.Errorf(err, "Expected error when creating artifact: %v", err)
suite.dao.AssertCalled(suite.T(), "Create", mock.Anything, &sa, mock.Anything)
suite.regCli.AssertCalled(suite.T(), "PushBlob", mock.Anything, mock.Anything, mock.Anything, mock.Anything)
}
func (suite *ManagerTestSuite) TestCreateArtifactRecordFailure() {
sa := model.SystemArtifact{
Repository: "test_repo",
Digest: "test_digest",
Size: int64(100),
Vendor: "test_vendor",
Type: "test_type",
CreateTime: time.Now(),
ExtraAttrs: "",
}
suite.dao.On("Create", mock.Anything, &sa, mock.Anything).Return(int64(0), errors.New("error")).Once()
suite.regCli.On("PushBlob", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Once()
suite.regCli.On("PushBlob", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Once()
suite.regCli.On("DeleteBlob", mock.Anything, mock.Anything).Return(nil).Once()
reader := strings.NewReader("test data string")
id, err := suite.mgr.Create(orm.NewContext(nil, &ormtesting.FakeOrmer{}), &sa, reader)
suite.Equalf(int64(0), id, "Expected no row to be inserted")
suite.Errorf(err, "Expected error when creating artifact: %v", err)
suite.dao.AssertCalled(suite.T(), "Create", mock.Anything, mock.Anything)
suite.regCli.AssertNotCalled(suite.T(), "PushBlob")
}
func (suite *ManagerTestSuite) TestRead() {
sa := model.SystemArtifact{
Repository: "test_repo",
Digest: "test_digest",
Size: int64(100),
Vendor: "test_vendor",
Type: "test_type",
CreateTime: time.Now(),
ExtraAttrs: "",
}
dummyRepoFilepath := fmt.Sprintf("/tmp/sys_art_test.dmp_%v", time.Now())
data := []byte("test data")
err := os.WriteFile(dummyRepoFilepath, data, os.ModePerm)
suite.NoErrorf(err, "Unexpected error when creating test repo file: %v", dummyRepoFilepath)
repoHandle, err := os.Open(dummyRepoFilepath)
suite.NoErrorf(err, "Unexpected error when reading test repo file: %v", dummyRepoFilepath)
defer repoHandle.Close()
suite.dao.On("Get", mock.Anything, "test_vendor", "test_repo", "test_digest").Return(&sa, nil).Once()
suite.regCli.On("PullBlob", mock.Anything, mock.Anything).Return(int64(len(data)), repoHandle, nil).Once()
readCloser, err := suite.mgr.Read(context.TODO(), "test_vendor", "test_repo", "test_digest")
suite.NoErrorf(err, "Unexpected error when reading artifact: %v", err)
suite.dao.AssertCalled(suite.T(), "Get", mock.Anything, "test_vendor", "test_repo", "test_digest")
suite.regCli.AssertCalled(suite.T(), "PullBlob", mock.Anything, mock.Anything, mock.Anything, mock.Anything)
suite.NotNilf(readCloser, "Expected valid read closer instance but was nil")
}
func (suite *ManagerTestSuite) TestReadSystemArtifactRecordNotFound() {
dummyRepoFilepath := fmt.Sprintf("/tmp/sys_art_test.dmp_%v", time.Now())
data := []byte("test data")
err := os.WriteFile(dummyRepoFilepath, data, os.ModePerm)
suite.NoErrorf(err, "Unexpected error when creating test repo file: %v", dummyRepoFilepath)
repoHandle, err := os.Open(dummyRepoFilepath)
suite.NoErrorf(err, "Unexpected error when reading test repo file: %v", dummyRepoFilepath)
defer repoHandle.Close()
errToRet := orm.ErrNoRows
suite.dao.On("Get", mock.Anything, "test_vendor", "test_repo", "test_digest").Return(nil, errToRet).Once()
suite.regCli.On("PullBlob", mock.Anything, mock.Anything).Return(int64(len(data)), repoHandle, nil).Once()
readCloser, err := suite.mgr.Read(context.TODO(), "test_vendor", "test_repo", "test_digest")
suite.Errorf(err, "Expected error when reading artifact: %v", errToRet)
suite.dao.AssertCalled(suite.T(), "Get", mock.Anything, "test_vendor", "test_repo", "test_digest")
suite.regCli.AssertNotCalled(suite.T(), "PullBlob")
suite.Nilf(readCloser, "Expected null read closer instance but was valid")
}
func (suite *ManagerTestSuite) TestDelete() {
suite.dao.On("Delete", mock.Anything, "test_vendor", "test_repo", "test_digest").Return(nil).Once()
suite.regCli.On("DeleteBlob", mock.Anything, mock.Anything).Return(nil).Once()
err := suite.mgr.Delete(context.TODO(), "test_vendor", "test_repo", "test_digest")
suite.NoErrorf(err, "Unexpected error when deleting artifact: %v", err)
suite.dao.AssertCalled(suite.T(), "Delete", mock.Anything, "test_vendor", "test_repo", "test_digest")
suite.regCli.AssertCalled(suite.T(), "DeleteBlob", "sys_harb0r/test_vendor/test_repo", "test_digest")
}
func (suite *ManagerTestSuite) TestDeleteSystemArtifactDeleteError() {
errToRet := orm.ErrNoRows
suite.dao.On("Delete", mock.Anything, "test_vendor", "test_repo", "test_digest").Return(errToRet).Once()
suite.regCli.On("DeleteBlob", mock.Anything, mock.Anything).Return(nil).Once()
err := suite.mgr.Delete(context.TODO(), "test_vendor", "test_repo", "test_digest")
suite.Errorf(err, "Expected error when deleting artifact: %v", err)
suite.dao.AssertCalled(suite.T(), "Delete", mock.Anything, "test_vendor", "test_repo", "test_digest")
suite.regCli.AssertCalled(suite.T(), "DeleteBlob", "sys_harb0r/test_vendor/test_repo", "test_digest")
}
func (suite *ManagerTestSuite) TestDeleteSystemArtifactBlobDeleteError() {
errToRet := orm.ErrNoRows
suite.dao.On("Delete", mock.Anything, "test_vendor", "test_repo", "test_digest").Return(nil).Once()
suite.regCli.On("DeleteBlob", mock.Anything, mock.Anything).Return(errToRet).Once()
err := suite.mgr.Delete(context.TODO(), "test_vendor", "test_repo", "test_digest")
suite.Errorf(err, "Expected error when deleting artifact: %v", err)
suite.dao.AssertNotCalled(suite.T(), "Delete", mock.Anything, "test_vendor", "test_repo", "test_digest")
suite.regCli.AssertCalled(suite.T(), "DeleteBlob", "sys_harb0r/test_vendor/test_repo", "test_digest")
}
func (suite *ManagerTestSuite) TestExist() {
sa := model.SystemArtifact{
Repository: "test_repo",
Digest: "test_digest",
Size: int64(100),
Vendor: "test_vendor",
Type: "test_type",
CreateTime: time.Now(),
ExtraAttrs: "",
}
suite.dao.On("Get", mock.Anything, "test_vendor", "test_repo", "test_digest").Return(&sa, nil).Once()
suite.regCli.On("BlobExist", mock.Anything, mock.Anything).Return(true, nil).Once()
exists, err := suite.mgr.Exists(context.TODO(), "test_vendor", "test_repo", "test_digest")
suite.NoErrorf(err, "Unexpected error when checking if artifact exists: %v", err)
suite.dao.AssertCalled(suite.T(), "Get", mock.Anything, "test_vendor", "test_repo", "test_digest")
suite.regCli.AssertCalled(suite.T(), "BlobExist", mock.Anything, mock.Anything)
suite.True(exists, "Expected exists to be true but was false")
}
func (suite *ManagerTestSuite) TestExistSystemArtifactRecordReadError() {
errToReturn := orm.ErrNoRows
suite.dao.On("Get", mock.Anything, "test_vendor", "test_repo", "test_digest").Return(nil, errToReturn).Once()
suite.regCli.On("BlobExist", mock.Anything, mock.Anything).Return(true, nil).Once()
exists, err := suite.mgr.Exists(context.TODO(), "test_vendor", "test_repo", "test_digest")
suite.Error(err, "Expected error when checking if artifact exists")
suite.dao.AssertCalled(suite.T(), "Get", mock.Anything, "test_vendor", "test_repo", "test_digest")
suite.regCli.AssertNotCalled(suite.T(), "BlobExist")
suite.False(exists, "Expected exists to be false but was true")
}
func (suite *ManagerTestSuite) TestExistSystemArtifactBlobReadError() {
sa := model.SystemArtifact{
Repository: "test_repo",
Digest: "test_digest",
Size: int64(100),
Vendor: "test_vendor",
Type: "test_type",
CreateTime: time.Now(),
ExtraAttrs: "",
}
suite.dao.On("Get", mock.Anything, "test_vendor", "test_repo", "test_digest").Return(&sa, nil).Once()
suite.regCli.On("BlobExist", mock.Anything, mock.Anything).Return(false, errors.New("test error")).Once()
exists, err := suite.mgr.Exists(context.TODO(), "test_vendor", "test_repo", "test_digest")
suite.Error(err, "Expected error when checking if artifact exists")
suite.dao.AssertCalled(suite.T(), "Get", mock.Anything, "test_vendor", "test_repo", "test_digest")
suite.regCli.AssertCalled(suite.T(), "BlobExist", mock.Anything, mock.Anything)
suite.False(exists, "Expected exists to be false but was true")
}
func (suite *ManagerTestSuite) TestGetStorageSize() {
suite.dao.On("Size", mock.Anything).Return(int64(400), nil).Once()
size, err := suite.mgr.GetStorageSize(context.TODO())
suite.NoErrorf(err, "Unexpected error encountered: %v", err)
suite.dao.AssertCalled(suite.T(), "Size", mock.Anything)
suite.Equalf(int64(400), size, "Expected size to be 400 but was : %v", size)
}
func (suite *ManagerTestSuite) TestGetStorageSizeError() {
suite.dao.On("Size", mock.Anything).Return(int64(0), errors.New("test error")).Once()
size, err := suite.mgr.GetStorageSize(context.TODO())
suite.Errorf(err, "Expected error encountered: %v", err)
suite.dao.AssertCalled(suite.T(), "Size", mock.Anything)
suite.Equalf(int64(0), size, "Expected size to be 0 but was : %v", size)
}
func (suite *ManagerTestSuite) TestCleanupCriteriaRegistration() {
vendor := "test_vendor"
artifactType := "test_artifact_type"
suite.mgr.RegisterCleanupCriteria(vendor, artifactType, suite)
criteria := suite.mgr.GetCleanupCriteria(vendor, artifactType)
suite.Equalf(suite, criteria, "Expected cleanup criteria to be the same as suite")
criteria = suite.mgr.GetCleanupCriteria("test_vendor1", "test_artifact1")
suite.Equalf(DefaultSelector, criteria, "Expected cleanup criteria to be the same as default cleanup criteria")
}
func (suite *ManagerTestSuite) TestCleanup() {
sa1 := model.SystemArtifact{
Repository: "test_repo1",
Digest: "test_digest1",
Size: int64(100),
Vendor: "test_vendor1",
Type: "test_type1",
CreateTime: time.Now(),
ExtraAttrs: "",
}
sa2 := model.SystemArtifact{
Repository: "test_repo2",
Digest: "test_digest2",
Size: int64(300),
Vendor: "test_vendor2",
Type: "test_type2",
CreateTime: time.Now(),
ExtraAttrs: "",
}
sa3 := model.SystemArtifact{
Repository: "test_repo3",
Digest: "test_digest3",
Size: int64(300),
Vendor: "test_vendor3",
Type: "test_type3",
CreateTime: time.Now(),
ExtraAttrs: "",
}
mockCleaupCriteria1 := cleanup.Selector{}
mockCleaupCriteria1.On("List", mock.Anything).Return([]*model.SystemArtifact{&sa1}, nil).Once()
mockCleaupCriteria2 := cleanup.Selector{}
mockCleaupCriteria2.On("List", mock.Anything).Return([]*model.SystemArtifact{&sa2}, nil).Once()
suite.cleanupCriteria.On("List", mock.Anything).Return([]*model.SystemArtifact{&sa3}, nil).Once()
suite.mgr.RegisterCleanupCriteria("test_vendor1", "test_type1", &mockCleaupCriteria1)
suite.mgr.RegisterCleanupCriteria("test_vendor2", "test_type2", &mockCleaupCriteria2)
suite.dao.On("Delete", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Times(3)
suite.regCli.On("DeleteBlob", mock.Anything, mock.Anything).Return(nil).Times(3)
totalDeleted, totalSizeReclaimed, err := suite.mgr.Cleanup(context.TODO())
suite.Equalf(int64(3), totalDeleted, "System artifacts delete; Expected:%d, Actual:%d", int64(3), totalDeleted)
suite.Equalf(int64(700), totalSizeReclaimed, "System artifacts delete; Expected:%d, Actual:%d", int64(700), totalDeleted)
suite.NoErrorf(err, "Unexpected error: %v", err)
}
func (suite *ManagerTestSuite) TestCleanupError() {
sa1 := model.SystemArtifact{
Repository: "test_repo13000",
Digest: "test_digest13000",
Size: int64(100),
Vendor: "test_vendor13000",
Type: "test_type13000",
CreateTime: time.Now(),
ExtraAttrs: "",
}
sa3 := model.SystemArtifact{
Repository: "test_repo33000",
Digest: "test_digest33000",
Size: int64(300),
Vendor: "test_vendor33000",
Type: "test_type33000",
CreateTime: time.Now(),
ExtraAttrs: "",
}
mockCleaupCriteria1 := cleanup.Selector{}
mockCleaupCriteria1.On("List", mock.Anything).Return([]*model.SystemArtifact{&sa1}, nil).Once()
mockCleaupCriteria2 := cleanup.Selector{}
mockCleaupCriteria2.On("List", mock.Anything).Return(nil, errors.New("test error")).Once()
suite.cleanupCriteria.On("List", mock.Anything).Return([]*model.SystemArtifact{&sa3}, nil)
suite.mgr.RegisterCleanupCriteria("test_vendor13000", "test_type13000", &mockCleaupCriteria1)
suite.mgr.RegisterCleanupCriteria("test_vendor23000", "test_type23000", &mockCleaupCriteria2)
suite.dao.On("Delete", mock.Anything, "test_vendor13000", "test_repo13000", "test_digest13000").Return(nil)
suite.dao.On("Delete", mock.Anything, "test_vendor33000", "test_repo33000", "test_digest33000").Return(nil)
suite.dao.On("Delete", mock.Anything, "test_vendor23000", "test_repo23000", mock.Anything).Return(nil)
suite.regCli.On("DeleteBlob", mock.Anything, mock.Anything).Return(nil)
totalDeleted, totalSizeReclaimed, err := suite.mgr.Cleanup(context.TODO())
suite.Equalf(int64(2), totalDeleted, "System artifacts delete; Expected:%d, Actual:%d", int64(2), totalDeleted)
suite.Equalf(int64(400), totalSizeReclaimed, "System artifacts delete; Expected:%d, Actual:%d", int64(400), totalDeleted)
suite.NoError(err, "Expected no error but was %v", err)
}
func (suite *ManagerTestSuite) TestCleanupErrorDefaultCriteria() {
sa1 := model.SystemArtifact{
Repository: "test_repo1",
Digest: "test_digest1",
Size: int64(100),
Vendor: "test_vendor1",
Type: "test_type1",
CreateTime: time.Now(),
ExtraAttrs: "",
}
sa2 := model.SystemArtifact{
Repository: "test_repo2",
Digest: "test_digest2",
Size: int64(300),
Vendor: "test_vendor2",
Type: "test_type2",
CreateTime: time.Now(),
ExtraAttrs: "",
}
mockCleaupCriteria1 := cleanup.Selector{}
mockCleaupCriteria1.On("List", mock.Anything).Return([]*model.SystemArtifact{&sa1}, nil).Once()
mockCleaupCriteria2 := cleanup.Selector{}
mockCleaupCriteria2.On("List", mock.Anything).Return([]*model.SystemArtifact{&sa2}, nil).Once()
suite.cleanupCriteria.On("List", mock.Anything).Return(nil, errors.New("test error"))
suite.mgr.RegisterCleanupCriteria("test_vendor1", "test_type1", &mockCleaupCriteria1)
suite.mgr.RegisterCleanupCriteria("test_vendor2", "test_type2", &mockCleaupCriteria2)
suite.dao.On("Delete", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil)
suite.regCli.On("DeleteBlob", mock.Anything, mock.Anything).Return(nil)
totalDeleted, totalSizeReclaimed, err := suite.mgr.Cleanup(context.TODO())
suite.Equalf(int64(2), totalDeleted, "System artifacts delete; Expected:%d, Actual:%d", int64(2), totalDeleted)
suite.Equalf(int64(400), totalSizeReclaimed, "System artifacts delete; Expected:%d, Actual:%d", int64(400), totalDeleted)
suite.NoErrorf(err, "Expected no error but was %v", err)
}
func (suite *ManagerTestSuite) TestCleanupErrorForVendor() {
sa1 := model.SystemArtifact{
Repository: "test_repo10000",
Digest: "test_digest10000",
Size: int64(100),
Vendor: "test_vendor10000",
Type: "test_type10000",
CreateTime: time.Now(),
ExtraAttrs: "",
}
sa2 := model.SystemArtifact{
Repository: "test_repo20000",
Digest: "test_digest20000",
Size: int64(300),
Vendor: "test_vendor10000",
Type: "test_type10000",
CreateTime: time.Now(),
ExtraAttrs: "",
}
sa3 := model.SystemArtifact{
Repository: "test_repo30000",
Digest: "test_digest30000",
Size: int64(300),
Vendor: "test_vendor30000",
Type: "test_type30000",
CreateTime: time.Now(),
ExtraAttrs: "",
}
mockCleaupCriteria1 := cleanup.Selector{}
mockCleaupCriteria1.On("List", mock.Anything).Return([]*model.SystemArtifact{&sa1, &sa2}, nil).Times(2)
suite.cleanupCriteria.On("List", mock.Anything).Return([]*model.SystemArtifact{&sa3}, nil).Times(2)
suite.mgr.RegisterCleanupCriteria("test_vendor10000", "test_type10000", &mockCleaupCriteria1)
suite.dao.On("Delete", mock.Anything, "test_vendor10000", "test_repo10000", "test_digest10000").Return(nil).Once()
suite.dao.On("Delete", mock.Anything, "test_vendor10000", "test_repo20000", "test_digest20000").Return(errors.New("test error")).Once()
suite.dao.On("Delete", mock.Anything, "test_vendor30000", "test_repo30000", "test_digest30000").Return(nil).Once()
suite.regCli.On("DeleteBlob", mock.Anything, mock.Anything).Return(nil).Times(3)
totalDeleted, totalSizeReclaimed, err := suite.mgr.Cleanup(context.TODO())
suite.Equalf(int64(2), totalDeleted, "System artifacts delete; Expected:%d, Actual:%d", int64(2), totalDeleted)
suite.Equalf(int64(400), totalSizeReclaimed, "System artifacts delete; Expected:%d, Actual:%d", int64(400), totalDeleted)
suite.NoErrorf(err, "Expected no error, but was %v", err)
}
func (suite *ManagerTestSuite) TestGetSystemArtifactProjectNames() {
reservedProjectNames := suite.mgr.GetSystemArtifactProjectNames()
suite.Equalf(1, len(reservedProjectNames), "Expected: %d, Actual: %d", 1, len(reservedProjectNames))
suite.Equalf(systemArtifactProjectName, reservedProjectNames[0], "Expected: %s, Actual: %s", systemArtifactProjectName, reservedProjectNames[0])
}
func (suite *ManagerTestSuite) List(ctx context.Context) ([]*model.SystemArtifact, error) {
return make([]*model.SystemArtifact, 0), nil
}
func (suite *ManagerTestSuite) ListWithFilters(ctx context.Context, query *q.Query) ([]*model.SystemArtifact, error) {
return make([]*model.SystemArtifact, 0), nil
}
func TestManagerTestSuite(t *testing.T) {
mgr := &ManagerTestSuite{}
suite.Run(t, mgr)
}
```
|
```java
package ai.verta.modeldb.common.futures;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiPredicate;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Value;
@Value
@Getter(AccessLevel.NONE)
class DoublingBackoffStrategy<R> implements RetryStrategy<R> {
private static final int INITIAL_DELAY_MILLIS = 10;
BiPredicate<R, Throwable> resultChecker;
int maxRetries;
AtomicInteger numberRetried = new AtomicInteger();
@Override
public Retry shouldRetry(R result, Throwable throwable) {
boolean shouldRetry = resultChecker.test(result, throwable);
if (!shouldRetry || numberRetried.get() == maxRetries) {
return new Retry(false, 0, TimeUnit.SECONDS);
}
int nextDelay = INITIAL_DELAY_MILLIS * (int) Math.pow(2, numberRetried.getAndIncrement());
return new Retry(true, nextDelay, TimeUnit.MILLISECONDS);
}
}
```
|
```javascript
//your_sha256_hash---------------------------------------
//your_sha256_hash---------------------------------------
function DumpArray(array)
{
WScript.Echo("[" + array.join(",") + "]");
}
function literalOfInts()
{
var array = [3, 4, 5, 6, 7, 8];
DumpArray(array);
var array_large = [3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8,
3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8,
3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8,
3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8,
3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8,
3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8,
3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8,
3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8,
3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8,
3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8,
3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8];
DumpArray(array_large);
}
function literalOfFloats()
{
var array = [3.5, 4, 5, 6, 7, 23.23];
DumpArray(array);
// more than 64 elements
var array_large = [3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23,
3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23,
3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23,
3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23,
3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23,
3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23,
3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23,
3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23,
3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23,
3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23,
3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23, 3.5, 4, 5, 6, 7, 23.23];
DumpArray(array_large);
}
function otherLiteral()
{
var array = [];
DumpArray(array);
array[3] = 32;
DumpArray(array);
var array1 = [new Object()];
var array1 = [new Object()];
}
function complexLiteral()
{
var array = [new Object(), 4, function() {}, 6, 7, 23.23];
DumpArray(array);
// Make the array1 itself dead and ensure that the code still works correctly with -recyclerstress
var array1 = [new Object(), 4, function() {}, 6, 7, 23.23];
var array1 = [new Object(), 4, function() {}, 6, 7, 23.23];
}
literalOfInts();
literalOfFloats();
otherLiteral();
complexLiteral();
```
|
Mary Patricia Nevill, Marchioness of Abergavenny (20 October 1915 – 22 February 2005) was a friend and Lady of the Bedchamber to Elizabeth II.
Life
She was born Mary Patricia Harrison, the daughter of John Harrison of King’s Walden, and his wife, Hon. Margaret Harrison, a daughter of William Levy-Lawson, 3rd Baron Burnham.
On 4 January 1938, she married the John Nevill, Earl of Lewes, who inherited his father's title of Marquess of Abergavenny in 1954, whereupon Patricia became Marchioness of Abergavenny. They had five children:
Lady Anne Patricia Nevill (b. 25 October 1938), married Captain Martin Whiteley and had issue.
Lady Vivienne Margaret Nevill (15 February 1941 – 10 September 2018), married Alan Lillingston and had issue.
Lady Jane Elizabeth Nevill (1944–1946), died in infancy.
Henry John Montague Nevill, Earl of Lewes (1948–1965), educated at Eton, died without issue.
Lady Rose Nevill (b. 15 July 1950); a bridesmaid at the wedding of Princess Margaret and Antony Armstrong-Jones. Lady Rose married George Clowes and had issue.
In 1960 it was suggested to her father (who lived at King's Walden and was a neighbour to the Strathmores' home of St. Paul's Walden Bury) that she become an Extra Lady of the Bedchamber to the Queen; and she held this position from 1960 to 1966. She then became a full Lady of the Bedchamber from 1966 until her retirement in 1987, when she reverted to an Extra Lady until her death.
Death
The Marchioness of Abergavenny died on 22 February 2005, aged 89.
Honours
In 1970, Lady Abergavenny was appointed CVO and in 1981 DCVO. In 1969, she received the Grand Decoration in Gold with Star for Services to the Republic of Austria.
Notes
1915 births
2005 deaths
British marchionesses
Dames Commander of the Royal Victorian Order
Ladies of the Bedchamber
Recipients of the Grand Decoration with Star for Services to the Republic of Austria
|
The 1977 Formula 750 season was the fifth season of the FIM Formula 750 World Championship and the first season to have full world championship status. Steve Baker was crowned champion, winning five races on aggregate.
Calendar
Notes:
1. - Heat two of the Daytona 200 was not run due to rain.
2. – Heat two of the Preis von Salzburg was abandoned due to rain.
Championship standings
References
See also
1977 Grand Prix motorcycle racing season
Books
Formula 750
Formula 750
|
```c++
/*=============================================================================
file LICENSE_1_0.txt or copy at path_to_url
==============================================================================*/
#if !defined(BOOST_SPIRIT_ERROR_HANDLER_APRIL_29_2007_1042PM)
#define BOOST_SPIRIT_ERROR_HANDLER_APRIL_29_2007_1042PM
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/spirit/home/qi/operator/expect.hpp>
#include <boost/spirit/home/qi/nonterminal/rule.hpp>
#include <boost/spirit/home/support/multi_pass_wrapper.hpp>
#include <boost/function.hpp>
#include <boost/assert.hpp>
namespace boost { namespace spirit { namespace qi
{
enum error_handler_result
{
fail
, retry
, accept
, rethrow
};
namespace detail
{
// Helper template allowing to manage the inhibit clear queue flag in
// a multi_pass iterator. This is the usual specialization used for
// anything but a multi_pass iterator.
template <typename Iterator, bool active>
struct reset_on_exit
{
reset_on_exit(Iterator&) {}
};
// For 'retry' or 'fail' error handlers we need to inhibit the flushing
// of the internal multi_pass buffers which otherwise might happen at
// deterministic expectation points inside the encapsulated right hand
// side of rule.
template <typename Iterator>
struct reset_on_exit<Iterator, true>
{
reset_on_exit(Iterator& it)
: it_(it)
, inhibit_clear_queue_(spirit::traits::inhibit_clear_queue(it))
{
spirit::traits::inhibit_clear_queue(it_, true);
}
~reset_on_exit()
{
// reset inhibit flag in multi_pass on exit
spirit::traits::inhibit_clear_queue(it_, inhibit_clear_queue_);
}
Iterator& it_;
bool inhibit_clear_queue_;
};
}
template <
typename Iterator, typename Context
, typename Skipper, typename F, error_handler_result action
>
struct error_handler
{
typedef function<
bool(Iterator& first, Iterator const& last
, Context& context
, Skipper const& skipper
)>
function_type;
error_handler(function_type subject_, F f_)
: subject(subject_)
, f(f_)
{
}
bool operator()(
Iterator& first, Iterator const& last
, Context& context, Skipper const& skipper) const
{
typedef qi::detail::reset_on_exit<Iterator
, traits::is_multi_pass<Iterator>::value &&
(action == retry || action == fail)> on_exit_type;
on_exit_type on_exit(first);
for(;;)
{
try
{
Iterator i = first;
bool r = subject(i, last, context, skipper);
if (r)
first = i;
return r;
}
catch (expectation_failure<Iterator> const& x)
{
typedef
fusion::vector<
Iterator&
, Iterator const&
, Iterator const&
, info const&>
params;
error_handler_result r = action;
params args(first, last, x.first, x.what_);
f(args, context, r);
// The assertions below will fire if you are using a
// multi_pass as the underlying iterator, one of your error
// handlers forced its guarded rule to 'fail' or 'retry',
// and the error handler has not been instantiated using
// either 'fail' or 'retry' in the first place. Please see
// the multi_pass docs for more information.
switch (r)
{
case fail:
BOOST_ASSERT(
!traits::is_multi_pass<Iterator>::value ||
action == retry || action == fail);
return false;
case retry:
BOOST_ASSERT(
!traits::is_multi_pass<Iterator>::value ||
action == retry || action == fail);
continue;
case accept: return true;
case rethrow: boost::throw_exception(x);
}
}
}
return false;
}
function_type subject;
F f;
};
template <
error_handler_result action
, typename Iterator, typename T0, typename T1, typename T2
, typename F>
void on_error(rule<Iterator, T0, T1, T2>& r, F f)
{
typedef rule<Iterator, T0, T1, T2> rule_type;
typedef
error_handler<
Iterator
, typename rule_type::context_type
, typename rule_type::skipper_type
, F
, action>
error_handler;
r.f = error_handler(r.f, f);
}
// Error handling support when <action> is not
// specified. We will default to <fail>.
template <typename Iterator, typename T0, typename T1
, typename T2, typename F>
void on_error(rule<Iterator, T0, T1, T2>& r, F f)
{
on_error<fail>(r, f);
}
}}}
#endif
```
|
Chengcing Lake (), also known as the Cheng Ching Lake, Dabei Lake (大貝湖), or Toapi Lake () in Taiwanese, is an artificial lake located in Niaosong, Kaohsiung, Taiwan. The lake is not far from downtown Kaohsiung and the major suburban district of Fengshan. The lake is a source of the water supply network and a tourist area of the Kaohsiung region.
Park and aquarium
A portion of the lake with its shore is administrated as a gated park. A chateau of Chiang Kai-shek, the former president and military leader of Taiwan, is located in the park. Around the lake shore, Chiang also established an underground military headquarters, which has been adapted into a public aquarium, the Cheng Ching Lake Exotic Marine Life Museum. It was originally built as a tunnel in 1961, as protection against a nuclear attack.
The Bridge of Nine Turns across the lake was built in 1960. It is 230 meters in length by 2.5 meters wide, including nine right-angled turns.
The restored Zhongxing Pagoda the lake area's tallest structure, standing 43 meters high, with good views from the top, which can be reached via winding stairs.
After Mainland China fell under the control of the Chinese Communist Party in 1949, General Huang Chieh led 30,000 Republic of China Army soldiers to Vietnam and they were stationed at Phu Quoc Island. Later, the army moved to Taiwan in June, 1953. There is currently a small island in Chengcing Lake that was constructed in November 1955 and named Fuguo Island (富國島) in memory of the fleeing Chinese soldiers in 1949.
See also
Kaohsiung Grand Hotel
Chengcing Lake Baseball Stadium
Guesthouses of Chiang Kai-shek
References
Lakes of Kaohsiung
|
Maximilian Marterer was the defending champion but lost in the quarterfinals to Stefano Travaglia.
Tallon Griekspoor won the title after defeating Zsombor Piros 6–3, 6–2 in the final.
Seeds
Draw
Finals
Top half
Bottom half
References
Main draw
Qualifying draw
2021 ATP Challenger Tour
2021 Singles
|
The discography of Lucinda Williams, an American singer, songwriter, and musician, consists of 15 studio albums, one live album, two video albums, and 25 singles, on Folkways Records, Smithsonian Folkways, Rough Trade Records, Chameleon, Mercury Records, Lost Highway Records, New West Records, Highway 20 Records, and Thirty Tigers.
Williams released her first albums, Ramblin' on My Mind (1979) and Happy Woman Blues (1980), on Folkways Records and Smithsonian Folkways. In 1988, she signed with Rough Trade Records and released her self-titled third album, Lucinda Williams, to critical raves. Her fourth album, Sweet Old World, appeared four years later on Chameleon Records, to further critical acclaim. In 1998, Car Wheels on a Gravel Road was released by Mercury Records, to critical and commercial success. The album was certified Gold by the RIAA the following year, and remains her best-selling album to date.
After signing with Lost Highway records, Williams released the albums Essence (2001), World Without Tears (2003), West (2007), Little Honey (2008), and Blessed (2011), all to further critical and commercial success. Additionally, the live album Live @ The Fillmore was released in 2005. The double albums Down Where the Spirit Meets the Bone (2014) and The Ghosts of Highway 20 (2016) appeared on Williams' own Highway 20 Records label. In 2017, This Sweet Old World was released on Highway 20 Records in conjunction with Nashville, Tennessee based distribution company Thirty Tigers, followed by the critically acclaimed Good Souls Better Angels in 2020. Later that year, Williams began "Lu's Jukebox", a six-episode series of themed live performances. Williams's 15th studio album, Stories from a Rock n Roll Heart, was released in 2023.
A collaborative album with Charles Lloyd and the Marvels, titled Vanished Gardens, appeared in 2018 on the Blue Note Records label.
Albums
Studio albums
Notes
Did not chart when first released in 1988. When reissued in 2014 it reached No. 39.
Reached No. 25 on the Billboard Top Heatseekers chart.
Reached No. 14 on the Canadian RPM Country Albums chart.
Live albums
Lu's Jukebox
Other albums
Singles
Video albums
Guest and compilation appearances
Credits adapted from AllMusic.
1988 – Various Artists – "Dark Side of Life" on A Town South of Bakersfield, Vols. 1 & 2
1990 – Various Artists – "Which Will" (first version) on True Voices
1990 – The Band of Blacky Ranchette – "Burning Desire" on Sage Advice
1992 – David Rodriguez – "Deportee (Plane Wreck at Los Gatos)" on The True Cross
1993 – Various Artists – "Pancakes" on Born to Choose
1993 – Various Artists – "Main Road" on Sweet Relief: A Benefit for Victoria Williams
1993 – Jimmie Dale Gilmore – "Reunion" on Spinning Around the Sun
1993 – Michael Fracasso – "Door No. 1" on Love & Trust
1994 – Various Artists – "You Don't Have Very Far to Go" on Tulare Dust: A Songwriter's Tribute to Merle Haggard
1994 – Various Artists – "Positively 4th Street" on In Their Own Words, Vol. 1 – Live Performances from the Bottom Line, New York City
1994 – Julian Dawson – "How Can I Sleep Without You" on How Human Hearts Behave
1994 – Lisa Mednick – "A Different Sky" on Artifacts of Love
1995 – Terry Allen – "Room to Room" and "Black to Black" on Human Remains
1995 – Kieran Kane – "This Dirty Little Town" on Dead Rekoning
1995 – Chris Gaffney – "Cowboys to Girls" on Loser's Paradise
1996 – Various Artists – "The Night's Too Long" on Lone Star: Original Soundtrack from the Film
1996 – Steve Earle – "You're Still Standing There" on I Feel Alright
1997 – RB Morris – "Glory Dreams" on Take That Ride
1997 – Ray Wylie Hubbard – "The Ballad of the Crimson Kings" on Dangerous Spirits
1997 – Donnie Fritts – "Breakfast in Bed" on Everybody's Got a Song
1997 – Bo Ramsey – "Desert Flower" on In the Weeds
1998 – Hayseed – "Precious Memories" and "Credo" on Melic
1998 – Robbie Fulks – "Pretty Little Poison" on Let's Kill Saturday Night
1998 – Various Artists – "Here in California" on Treasures Left Behind: Remembering Kate Wolf
1998 – Nanci Griffith – "Wings of a Dove" on Other Voices, Too (A Trip Back to Bountiful)
1998 – Various Artists – "Come to Me Baby" on Wolf Tracks: A Tribute to Howlin' Wolf
1999 – Bonepony – "Sweet Bye and Bye" on Traveler's Companion
1999 – Bruce Cockburn – "When You Give It Away", "Isn't That What Friends Are For?", "Look How Far" and "Use Me While You Can" on Breakfast in New Orleans, Dinner in Timbuktu
1999 – Julian Dawson – "How Can I Sleep Without You" on Spark
1999 – Leftover Salmon – "Lines Around Your Eyes" on The Nashville Sessions
1999 – Various Artists – "Return of the Grievous Angel" with David Crosby on Return of the Grievous Angel: Tribute to Gram Parsons
1999 – John Prine – "Wedding Bells"/"Let's Turn Back The Years" on In Spite of Ourselves
1999 – Little Milton – "Love Hurts" on Welcome to Little Milton
1999 – Evie Sands – "Cool Blues Story" on Women in Prison
1999 – Chip Taylor – "Through Their Mother's Eyes" and "If I Don't Know Love" on Seven Days in May...a love story
2000 – Sue Foley – "Empty Cup" on Love Comin' Down
2000 – Kevin Gordon – "Down to the Well" on Down to the Well
2000 – Chip Taylor – "Head First", "Annie on Your Mind" and "The Ghost of Phil Sinclair" on The London Sessions Bootleg
2001 – Kasey Chambers – "On a Bad Day" on Barricades & Brickwalls
2001 – Matthew Ryan – "Devastation" on Concussion
2001 – Various Artists – "Cold, Cold Heart" on Timeless: Hank Williams Tribute
2001 – Ralph Stanley and Friends – "Farther Along" on Clinch Mountain Sweethearts
2001 – Various Artists – "Nothin'" on A Tribute to Townes Van Zandt
2001 – Chip Taylor – "Could I Live with This" and "The Ship" on Black and Blue America
2001 – Various Artists – "Angels Laid Him Away" on Avalon Blues: A Tribute to the Music of Mississippi John Hurt
2002 – Various Artists – "Lately" on Going Driftless: An Artist's Tribute to Greg Brown
2003 – Various Artists – "Hang Down Your Head" on Crossing Jordan – Original Soundtrack
2003 – Terri Binion – "GayleAnne" on Fool
2003 – Various Artists – "Hard Times Killing Floor Blues" on Martin Scorsese Presents the Blues: The Soul of a Man
2003 – Colin Linden – "Don't Tell Me" on Big Mouth
2004 – Graham Parker – "Cruel Lips" on Your Country
2004 – Flogging Molly – "Factory Girls" on Within a Mile of Home
2004 – Elvis Costello – "There's a Story in Your Voice" on The Delivery Man
2004 – Willie Nelson – "Overtime" on It Always Will Be
2004 – Willie Nelson – "Overtime" (live) on Outlaws and Angels
2004 – Various Artists – "Pyramid of Tears" on Por Vida – A Tribute to the Songs of Alejandro Escovedo
2004 – Various Artists – "Down to the Well" with Kevin Gordon on No Depression: What It Sounds Like, Vol. 1
2004 – Tony Joe White – "Closing In on the Fire" on The Heroines
2005 – North Mississippi Allstars – "Hurry Up Sunrise" on Electric Blue Watermelon
2006 – Tim Easton – "Back to the Pain" on Ammunition
2006 – Ramblin' Jack Elliott – "Careless Darling" on I Stand Alone
2006 – P.F. Sloan – "Sins of a Family" on Sailover
2006 – John Brannen – "A Cut So Deep" on Twilight Tattoo
2006 – Anne McCue – "Hellfire Raiser" on Koala Motel
2006 – Various Artists – "Bonnie Portmore" on Rogue's Gallery: Pirate Ballads, Sea Songs, and Chanteys
2006 – Doug Pettibone – "Two of Us" and "She Belongs to Me" on The West Gate
2007 – Various Artists – "Honey Chile" on Goin' Home: A Tribute to Fats Domino
2007 – John Platania – "In Memory of Zapata" on Blues, Waltzes & Badland Borders
2008 – Various Artists – "Mamas Don't Let Your Babies Grow Up to Be Cowboys" on The Imus Ranch Record
2008 – Carrie Rodriguez – Mask of Moses on "She Ain't Me"
2009 – Susan Marshall – "Don't Let Me Down" on Little Red
2009 – Various Artists – "Positively 4th Street" (studio version) on The Village: A Celebration of the Music of Greenwich Village
2009 – M. Ward – "Oh Lonesome Me" on Hold Time
2010 – Various Artists – "Kiss Like Your Kiss" with Elvis Costello on True Blood – Music from the HBO Original Series Volume 2 [Soundtrack]
2010 – Various Artists – "The Ballad of Lucy Jordan" on Twistable, Turnable Man: A Musical Tribute to the Songs of Shel Silverstein
2010 – Ray Davies – "Long Way from Home" on See My Friends (album)
2010 – Jimmy Webb – "Galveston" on Just Across The River
2010 – Various Artists – "Somebody Somewhere (Don't Know What He's Missin' Tonight)" on Coal Miner's Daughter: A Tribute to Loretta Lynn
2011 – Over the Rhine – "Undamned" on The Long Surrender
2011 – Michael Monroe – "Gone, Baby Gone" on Sensory Overdrive
2011 – Amos Lee – "Clear Blue Eyes" on Mission Bell
2011 – Blackie & The Rodeo Kings – "If I Can't Have You" on Kings & Queens
2011 – Steve Cropper – "Dedicated to the One I Love" and "When I Get Like This" on Dedicated: A Salute to the 5 Royales
2011 – Son of the Velvet Rat – "Moment of Fame" and "White Patch of Canvas" on Red Chamber Music
2011 – Tom Russell – "A Hard Rain's A-Gonna Fall" on Mesabi
2011 – Various Artists – "I'm So Happy I Found You" on The Lost Notebooks of Hank Williams
2012 – Marvin Etzioni – "Lay It on the Table" on Marvin Country!
2012 – Lil' Band o' Gold – "I'm Ready" on Lil' Band o' Gold Plays Fats
2012 – Walter Rose – "Driving South" on Cast Your Stone
2012 – Various Artists – "Tryin' to Get to Heaven" on Chimes of Freedom: The Songs of Bob Dylan Honoring 50 Years of Amnesty International
2012 – Various Artists – "God I'm Missing You" on KIN: Songs by Mary Karr & Rodney Crowell
2012 – Various Artists – "Hurt" on We Walk the Line: A Celebration of the Music of Johnny Cash
2012 – Various Artists – "That Time Of Night" on Oh Michael, Look What You've Done: Friends Play Michael Chapman
2012 – Various Artists – "The Farm" on The Inner Flame: A Rainer Ptacek Tribute
2012 – Various Artists – "Mississippi You're On My Mind" on Quiet About It: A Tribute To Jesse Winchester
2012 – Various Artists – "Whispering Pines" on Love for Levon
2012 – Various Artists – "House of Earth" on Woody Guthrie at 100: Live at the Kennedy Center
2013 – Various Artists – "Everything But the Truth" (first version) on The Lone Ranger: Wanted
2013 – Various Artists – "This Old Guitar" on The Music Is You: A Tribute to John Denver
2013 – Various Artists – "Partners in Crime" on Songs for Slim: Rockin' Here Tonight—A Benefit Compilation for Slim Dunlap
2014 – Chip Taylor – "Sleep with Open Windows" and "I'll Only Be Me Once" on The Little Prayers Trilogy
2014 – Various Artists – "The Pretender" on Looking into You: A Tribute To Jackson Browne
2015 – Buick 6 – "So Much Trouble in the World" on Plays Well with Others
2015 – G. Love and Special Sauce – "New York City" on Love Saves the Day
2015 – Don Henley – "Train in the Distance" on Cass County
2015 – Boz Scaggs – "Whispering Pines" (duet version) on A Fool to Care
2015 – Various Artists – "Met an Old Friend" on Remembering Mountains: Unheard Songs by Karen Dalton
2016 – Buddy Miller – "Hickory Wind" (duet version) on Cayamo Sessions at Sea
2016 – Various Artists – "It's Nobody's Fault But Mine" and "God Don't Never Change" on God Don't Never Change: The Songs of Blind Willie Johnson
2016 – Various Artists – "Hickory Wind" on The Life & Songs of Emmylou Harris
2018 – Charles Lloyd – Vanished Gardens (with The Marvels)
2019 - Jesse Malin - "Room 13", "Shane", "Dead On" on Sunset Kids (album co-produced by Williams)
2020 – Various Artists - "Life's a Gass" on Angelheaded Hipster: The Songs of Marc Bolan & T. Rex
2021 – Sharon Van Etten – "Save Yourself" on Epic Ten
2021 - Robert Plant and Alison Krauss - Backing vocals on Raise the Roof
References
External links
Lucinda Williams' official website
Discography
Discographies of American artists
Country music discographies
Pop music discographies
Rock music discographies
|
George T. Kenney Jr. (born October 29, 1957) is a former Republican member of the Pennsylvania House of Representatives. He represented the 170th District from 1985 to 2008.
Formative years
Born in the city of Philadelphia, Pennsylvania on October 29, 1957, Kenney graduated from LaSalle High School and then earned a Bachelor of Science degree from LaSalle College in 1982. He was subsequently employed in pharmaceutical sales with McNeil Pharmaceutical.
Family
Kenney and his wife Elizabeth live in Philadelphia, Pennsylvania and have 5 children.
Political career
Treasurer and leader of the 58th Ward Republican Executive Committee, Kenney was elected to the Pennsylvania House of Representatives in 1984, and then reelected to eleven additional consecutive terms. Appointed to the Pennsylvania Commission on Crime and Delinquency (1997-2002), he did not stand for reelection to the House in 2008, but was elected that year as an alternate delegate to the 2008 Republican National Convention.
He was succeeded in the House by Democrat Brendan F. Boyle.
Later professional life
Kenney has served as the assistant vice president for government affairs, Health Sciences at Temple University.
References
External links
Pennsylvania House of Representatives - George T. Kenney official PA House website (archived)
Pennsylvania House Republican Caucus - Representative George T. Kenney official Party website (archived)
Biography, voting record, and interest group ratings at Project Vote Smart
1957 births
Living people
Republican Party members of the Pennsylvania House of Representatives
|
```c
/*
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
int main() {
signed long long int a = 4L;
return a;
}
```
|
The Rexurdimento (Galician for Resurgence) was a period in the History of Galicia during the 19th century. Its central feature was the revitalization of the Galician language as a vehicle of social and cultural expression after the so-called séculos escuros ("dark centuries") in which the dominance of Castilian Spanish was nearly complete. The Galician Rexurdimento coincides with the Catalan Renaixença.
Romanticism led to a revival of regionalism in the Iberian Peninsula. Languages besides the official Castilian Spanish were reevaluated. In contrast to the universalizing Age of Enlightenment, a positive value was placed on regional traditions, languages, and dialects. In Galicia, Castilian Spanish had become the language of the cities and of the bourgeoisie, while Galician had become a largely rural language without a live literary tradition. This created some degree of diglossia, with Castilian Spanish dominating literary and business use, and Galician being strictly a language of daily life.
Road to the Rexurdimento
The transitional phase from the to the Rexurdimento is referred to by literary historians as the Prerrexurdimento. Within the Prerrexurdimento, two phases can be roughly distinguished, before and after the unsuccessful Solís Uprising of 1846. The first phase involved a rather diffuse revival of the Galician language; the second is more concentrated, including the first new Galician-language works in centuries to gain acclaim.
From 1840 onward, groups of intellectuals saw Galicia as a backward region whose advancement was dependent on the formation of a regional or national identity. This provincialist movement centered at the University of Santiago de Compostela; its most prominent figure was Antolín Faraldo Asorey.
The failed Solís Uprising of 1846, an uprising against centralism, ended with the summary execution of the so-called Martyrs of Carral. This political and military defeat nonetheless awoke Galician literary consciousness. Authors who shared the idea of Galicia as their fatherland published in magazines such as El Centinela de Galicia ("The Galician Sentinel") and La Aurora de Galicia. Benito Viceto published a History of Galicia (1865–1866) a heroic narrative of Galician history in six volumes. Important works from this period include the Proezas de Galicia ("Prowess of Galicia") by Fernández Neira, A gaita gallega ("The Galician Bagpipes") by Juan Manuel Pintos (1853), the founding of the Juegos Florales de Galicia ("Floral Games of Galicia") in A Coruña (1861), as well as publications such as El álbum de la caridad ("The Charity Album") and newspapers that published fragments of Galician-language novels and plays.
The two foremost Galician-language genres from this time were political writings and the revival of Galician as a literary language. The first of the political writings were linked to the Peninsular War, viewed throughout Spain as a war of independence against Napoleonic France: Un labrador que foi sarxento ("A farmer who was a sergeant", 1808) and several dialogues, the first of them being Proezas de Galicia explicadas baxo la conversación rústica de los dos compadres Chinto y Mingote ("Prowess of Galicia explained through the rustic conversation of two comrades Chinto and Mingote") by José Fernández de Neira (1812). Later, pamphlets and newspapers published polemics on both sides in the struggle between absolutism and liberalism, and other polemics critical of the administrative situation of the region. On the literary front were villancicos (intended to be sung), one play (A casamenteira by Antonio Benito Fandiño, published in 1849 and centered on arranged marriage), satirical sonnets, two books of poetry by Nicomedes Pastor Díaz, and various other works. Francisco Añón was another author relevant in this period.
Professor Dolores Vilavedra, while cautious in drawing conclusions, sees this phase of the Prerrexurdimento as basically a Galician form of artistic and political Romanticism. Some institutions developed during this period, such as an Academia Literaria de Santiago with its official organ El Idólatra de Galicia, and magazines such as Revista de Galicia. However, many of these institutions were repressed after the 1846 Solís Uprising.
The intellectual heirs of this thwarted movement were a group of young people, among them Manuel Murguía, Eduardo Pondal, and Rosalía de Castro. Their gathering in 1856 at the Banquete de Conxo ("Banquet of Conxo") marks the founding of the Liceo de la Juventud as a gathering place and a base for cultural activism.
The Rexurdimento proper
The Rexurdimento is conventionally considered to begin with the publication of Rosalía de Castro's book of poems Cantares Gallegos in 1863. Nonetheless, there is no sharp break from the Prerrexurdimento to the Rexurdimento, and there were no other significant publications in Galician for over a decade after the Cantares Gallegos, a period that includes Spain's Glorious Revolution and the subsequent liberal era.
However, beginning in 1875 more works were published in Galician, including, again, newspapers, the most famous of which was O Tío Marcos da Portela ("Uncle Marcos from Portela", 1876–1889). The Biblioteca Gallega ("Galician Library") published 52 works beginning in 1885, including such prominent works as Aires da miña terra ("Airs of My Land") by Manuel Curros Enríquez and Queixumes dos Pinos ("Moans of the Pines") by Eduardo Pondal.
1880 was a particularly outstanding year, with the publication of Follas Novas ("New Leaves") by Rosalía de Castro, Aires da miña terra by Curros Enríquez, and Espiñas, follas e frores. Ramiño primeiro ("Spines, Leaves, and Fronds. First Sprigs") by Valentín Lamas Carvajal.
In 1886, for the first time, a literary contest was held, confined to Galician-language works. Poetry was particularly prominent, and anthologies of Galician poetry began to appear. In a more political vein, that year saw the publication of Los precursores ("The Precursors") by Manuel Murguía.
These years also saw the publication of many grammar books, dictionaries, and critical literary studies, and further history books, including another History of Galicia by Manuel Murguía. Furthermore, there was a recovery of the splendid works in Galician by medieval troubadours ), the Cantigas. The first such work to be published was the Cancionero de la Vaticana (1875), followed by Colocci Brancuti (1889), Cantigas de Alfonso X El Sabio (1889), and Cancionero de Ajuda (1904).
The first significant published prose fiction in Galician was by Marcial Valladares Núñez. His Maxina ou a filla espúrea ("Maxina or A Spurious Daughter") appeared in the 1880s in a series of inserts in a magazine; the manuscript dates from 1870). The book is particularly unusual in its mix of Galician and Castilian Spanish to suggest the bifurcated lives of its characters. The first drama in Galician was Rentar de Castromil (1904) by Evaristo Martelo Paumán.
The canon Antonio López Ferreiro is considered the true father of the Galician novel. He wrote three novels, the best known of which is A tecedeira de Bonabal ("The Weaver of Bonabal"), published in installments in Galician newspapers. These realistic works with aspects of the historical novel are set at different points in Galician history.
Costumbrismo, the literary or pictorial interpretation of local everyday life, mannerisms, and customs, was also active in Galicia, as it was elsewhere in Spain. However, in Galicia it focused almost entirely on rural life. Urban narratives in Galician began to appear only toward the end of the 19th century, as in the work of Francisco Álvarez de Novoa, urban, bourgeois, and psychological. This was a prelude to the innovative writers of the Irmandades da fala.
There were very few theatrical works associated with the Rexurdimento.
Notes
History of Galicia (Spain)
National revivals
19th century in Spain
|
Araho Shrine (荒穂神社, Araho Jinja) is a Shinto shrine located in Kiyama, Saga Prefecture, Japan.
History
The temple is said to have been built in the 7th century CE, during the reign of Emperor Kōtoku.
The shrine stands on the southern foot of Mount Kizan, which is the site of Kii Castle, a nationally designated historic site. Records from The Three Major Records of Japan (日本三大実録, Nihon Sandai Jitsuroku) of 860 mention that Araho was among a select number of shrines which had been granted a degree of the fifth highest rank. In the Engishiki, a document about royal ceremony in the Heian Period, this shrine is counted as one of the four National shrines of the Third (lowest) Rank (国幣小社, Kokuhei Chūsha) in the Hizen Province.
Gallery
See also
Kii Castle
References
External links
Araho-jinja - Kyushu-jinja.com
Shinto shrines in Saga Prefecture
7th-century establishments in Japan
|
```swift
import Foundation
// This reimplements CMTime such that it can reach across to Linux
public struct TimestampFlags: OptionSet {
public let rawValue:UInt32
public init(rawValue:UInt32) { self.rawValue = rawValue }
public static let valid = TimestampFlags(rawValue: 1 << 0)
public static let hasBeenRounded = TimestampFlags(rawValue: 1 << 1)
public static let positiveInfinity = TimestampFlags(rawValue: 1 << 2)
public static let negativeInfinity = TimestampFlags(rawValue: 1 << 3)
public static let indefinite = TimestampFlags(rawValue: 1 << 4)
}
public struct Timestamp: Comparable {
let value:Int64
let timescale:Int32
let flags:TimestampFlags
let epoch:Int64
public init(value:Int64, timescale:Int32, flags:TimestampFlags, epoch:Int64) {
self.value = value
self.timescale = timescale
self.flags = flags
self.epoch = epoch
}
func seconds() -> Double {
return Double(value) / Double(timescale)
}
}
public func ==(x:Timestamp, y:Timestamp) -> Bool {
// TODO: Fix this
// if (x.flags.contains(TimestampFlags.PositiveInfinity) && y.flags.contains(TimestampFlags.PositiveInfinity)) {
// return true
// } else if (x.flags.contains(TimestampFlags.NegativeInfinity) && y.flags.contains(TimestampFlags.NegativeInfinity)) {
// return true
// } else if (x.flags.contains(TimestampFlags.Indefinite) || y.flags.contains(TimestampFlags.Indefinite) || x.flags.contains(TimestampFlags.NegativeInfinity) || y.flags.contains(TimestampFlags.NegativeInfinity) || x.flags.contains(TimestampFlags.PositiveInfinity) && y.flags.contains(TimestampFlags.PositiveInfinity)) {
// return false
// }
let correctedYValue:Int64
if (x.timescale != y.timescale) {
correctedYValue = Int64(round(Double(y.value) * Double(x.timescale) / Double(y.timescale)))
} else {
correctedYValue = y.value
}
return ((x.value == correctedYValue) && (x.epoch == y.epoch))
}
public func <(x:Timestamp, y:Timestamp) -> Bool {
// TODO: Fix this
// if (x.flags.contains(TimestampFlags.PositiveInfinity) || y.flags.contains(TimestampFlags.NegativeInfinity)) {
// return false
// } else if (x.flags.contains(TimestampFlags.NegativeInfinity) || y.flags.contains(TimestampFlags.PositiveInfinity)) {
// return true
// }
if (x.epoch < y.epoch) {
return true
} else if (x.epoch > y.epoch) {
return false
}
let correctedYValue:Int64
if (x.timescale != y.timescale) {
correctedYValue = Int64(round(Double(y.value) * Double(x.timescale) / Double(y.timescale)))
} else {
correctedYValue = y.value
}
return (x.value < correctedYValue)
}
```
|
```java
package josh.utils.events;
import java.util.EventListener;
public interface DNSConfigListener extends EventListener {
public abstract void DNSToggle(DNSEvent e);
public abstract void DNSStop(DNSEvent e);
//public abstract void StopSniffer(DNSEvent e);
//public abstract void StartSniffer(DNSEvent e);
}
```
|
```javascript
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Check that the we are still in function context when we break on return.
var Debug = debug.Debug;
function listener(event, exec_state, event_data, data) {
if (event == Debug.DebugEvent.Break) {
// Access scope details to check the context is correct.
var scope_count = exec_state.frame().scopeCount();
// Do steps until we reach the global scope again.
exec_state.prepareStep(Debug.StepAction.StepIn);
}
}
Debug.setListener(listener);
function f() {
debugger;
L: with ({x:12}) {
break L;
}
return;
}
f();
```
|
The team competition of the open water swimming events at the 2011 World Aquatics Championships was held on July 21. Each team consisted of 3 swimmers, two men and one woman, who swam 5 km each.
Medalists
Results
The race was held on July 21.
References
External links
2011 World Aquatics Championships: Team start list, from OmegaTiming.com; retrieved 2011-07-20.
Team
World Aquatics Championships
|
ChessCube.com was an online chess community with over 1,400,000 registered members. ChessCube.com was founded in 2007 by Mark Levitt, and offered live play, chat, and ChessCube Cinema. In 2009, ChessCube hosted the world's first FIDE-rated online matches played in the South African Open 2009 where arbiters were present near the players' computers as supervisors. On January 31, 2020, ChessCube officially ceased operations.
History
Mark Levitt, founder of ChessCube, was involved in chess publishing in the early 1990s. From 1997 to 1998, Mark built the online Chess World for British Telecom's GamePlay.com, but GamePlay.com naturally dropped its board and card games in 1999 after it listed. Mark launched ChessCube as a market test in 2007 in South Africa, and ChessCube was offered internationally in January 2008. As of August 2009, ChessCube had over 650,000 registered users from over 200 countries. On 10 August 2009, ChessCube announced a US$1.25m VC funding from InVenFin.
ChessCube has secured $1.8m to date in venture capital. Investors include InVenFin, a subsidiary of Venfin Limited, Michael Leeman and Vinny Lingham. ChessCube shut down on 31 January 2020.
Users
ChessCube had over 1,000,000 registered users globally.
ChessCube's community was managed by moderators who were ChessCube players themselves. Moderators might mute players who were abusive. They could also, as similar to members, report users if it seemed like they were cheating. Various chat rooms were set up for various groups, mainly by country, but also by politics, and other discussions. A dedicated ChessCube forum also existed independently of the main site to discuss the site and other topics.
Memberships
In mid-2011, ChessCube switched to VIP memberships while still allowing people without memberships to play a limited number of games for free. Players could win in-site currency 'cubits' by betting and winning games. These cubits could then be spent to play games beyond the free game limit. VIP members gained VIP status by buying crowns, another form of in-site currency, and were able to play in hourly VIP-only tournaments. VIP members were adorned with a golden username instead of the usual grey as well as a crown under their mini-profile. Similar to other sites, Grandmasters and other FIDE titled players automatically gained premium memberships.
Features
The ChessCube live chess was developed in Adobe Flash.
ChessCube Play was ChessCube's live chess platform. Games can be rated or unrated, tournament or standard, and timed or untimed. Fast games are timed games less than 10 minutes. Slow games are games longer than 15 minutes. Games can be standard or Chess960, a variant where starting positions are shuffled. Registered users who are logged in can spectate live games. "Tournament or standard" refer to either playing solo live games or tournaments on the site where people pay cubits to enter. People have two different ratings, one as their "standard rating" and the other as their "tournament" rating. People who do well in these tournaments gain prizes, usually cubits, but occasionally crowns.
ChessCube Chat allows all registered players who are logged in to chat to one another, either in chat rooms, while playing chess games against one another or while spectating chess games.
ChessCube also allows all registered players to have a customizable profile, invite friends, follow friends, and earn cubits, which is like a currency for the chess site. Cubits can be used to buy items in the virtual store such as backgrounds, voices, chess piece colors, and chess piece styles. They can also be used to play games. "Crowns" are another form of currency, mostly for premium/VIP players but also for those who are strong enough to win tournaments where they are crowns as prizes. Crowns can be used to enter specific tournaments and to buy things at a much lower "level" easier and permanently.
ChessCube Cinema is an Adobe AIR application that can be downloaded to a user's desktop. It allows chess videos and lectures to be downloaded and viewed by the user. These videos allow a chessboard demonstrating the lecture to be viewed alongside the lecturer. The Foxy Openings series can be purchased to be viewed on ChessCube Cinema.Kb.
SA Open 2009
In July 2009, ChessCube sponsored the South African Open held at Wynberg Boys' High School. After negotiating with FIDE, the World Chess Federation, several matches were played online using ChessCube. These matches were FIDE-rated — a world first for chess. Participants in Melbourne, Australia, played against participants in Cape Town. Amon Simutowe won the SA Open 2009.
Awards
ChessCube was a semifinalist in the Adobe MAX 2008 Awards.
ChessCube won the 2008 WP Sports Award: Media Award – Electronic.
See also
List of Internet chess servers
Rules of chess
References
External links
Internet chess servers
Chess websites
Internet properties established in 2007
Internet properties disestablished in 2020
|
Palazzo Corvaja (sometimes spelt Palazzo Corvaia) is a medieval palace in Taormina, Sicily, Italy. It was principally built at the end of the 14th century and is named after one of the oldest and most famous families of Taormina, which owned it from 1538 to 1945.
On four main floors and constructed around a courtyard, the Catalan Gothic palazzo is crenellated. The principal floor has fenestration of pairs of lancet windows divided by columns. The courtyard walls are decorated by reliefs illustrating The Creation.
Arab Tower in the Palazzo Corvaja: The tower was incorporated into other parts of the building from the end of the AD 13th century.
Today the palazzo is used as an exhibition centre.
History
Corvaja Palace, which is located in Piazza Badia at right angles to the church of Saint Catherine of Alexandria, The origins of the palazzo incorporate an early Norman fortress dating from the 12th-14th century, which in turn was constructed on Roman foundations. It was subsequently added to over various periods up until the 15th century. Its main body is an Norman-style tower, and it has an inner courtyard where the Gothic influence can be seen in the arched windows and doorways. A 13th century staircase leads up to the first floor and an ornamental balcony which overlooks the courtyard.
In 1410, Corvaja Palace housed the Sicilian Parliament. It was renovated in 1945 by Armando Dillo, and as of 2009 it is the seat for the Azienda Autonoma Soggiorno e Turismo.
References
Sources
Taormina in Tasca, published by Dario Flaccovio Editore, June 2003
External links
Image of Palazzo Corvaja
Buildings and structures completed in the 10th century
Corvaia
Taormina
Buildings and structures completed in the 14th century
Medieval Italian architecture
14th-century establishments in Italy
10th-century establishments in Italy
|
Kolonia Zamek is a village in the administrative district of Gmina Modliborzyce, within Janów Lubelski County, Lublin Voivodeship, in eastern Poland.
References
Kolonia Zamek
|
```c++
// This Source Code Form is subject to the terms of the Mozilla Public
// file, You can obtain one at path_to_url
#ifdef __linux__
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/types.h>
/*
* These definitions MUST remain in the global namespace.
*/
extern "C"
{
/*
* The real socket(2), renamed by GCC.
*/
int __real_socket(int domain, int type, int protocol) noexcept;
/*
* Overrides socket(2) to set SOCK_CLOEXEC by default.
*/
int __wrap_socket(int domain, int type, int protocol) noexcept
{
return __real_socket(domain, type | SOCK_CLOEXEC, protocol);
}
/*
* Overrides accept(2) to set SOCK_CLOEXEC by default.
*/
int __wrap_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
{
return accept4(sockfd, addr, addrlen, SOCK_CLOEXEC);
}
/*
* The real open(2), renamed by GCC.
*/
int __real_open(const char *pathname, int flags, mode_t mode);
/*
* Overrides open(2) to set O_CLOEXEC by default.
*/
int __wrap_open(const char *pathname, int flags, mode_t mode)
{
return __real_open(pathname, flags | O_CLOEXEC, mode);
}
}
#endif
```
|
```cmake
set(SUPPORTED_EMU_PLATFORMS qemu)
set(QEMU_CPU_TYPE_${ARCH} nios2)
set(QEMU_FLAGS_${ARCH}
-machine altera_10m50_zephyr
-nographic
)
board_set_debugger_ifnset(qemu)
```
|
```java
/**
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package org.thingsboard.rule.engine.transform;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.mockito.ArgumentCaptor;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.rule.engine.api.TbContext;
import org.thingsboard.rule.engine.api.TbNodeConfiguration;
import org.thingsboard.rule.engine.api.TbNodeException;
import org.thingsboard.rule.engine.util.TbMsgSource;
import org.thingsboard.server.common.data.id.DeviceId;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.msg.TbMsgType;
import org.thingsboard.server.common.msg.TbMsg;
import org.thingsboard.server.common.msg.TbMsgMetaData;
import org.thingsboard.server.common.msg.queue.TbMsgCallback;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Stream;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
public class TbRenameKeysNodeTest {
DeviceId deviceId;
TbRenameKeysNode node;
TbRenameKeysNodeConfiguration config;
TbNodeConfiguration nodeConfiguration;
TbContext ctx;
TbMsgCallback callback;
@BeforeEach
void setUp() throws TbNodeException {
deviceId = new DeviceId(UUID.randomUUID());
callback = mock(TbMsgCallback.class);
ctx = mock(TbContext.class);
config = new TbRenameKeysNodeConfiguration().defaultConfiguration();
config.setRenameKeysMapping(Map.of("TestKey_1", "Attribute_1", "TestKey_2", "Attribute_2"));
nodeConfiguration = new TbNodeConfiguration(JacksonUtil.valueToTree(config));
node = spy(new TbRenameKeysNode());
node.init(ctx, nodeConfiguration);
}
@AfterEach
void tearDown() {
node.destroy();
}
@Test
void givenDefaultConfig_whenVerify_thenOK() {
TbRenameKeysNodeConfiguration defaultConfig = new TbRenameKeysNodeConfiguration().defaultConfiguration();
assertThat(defaultConfig.getRenameKeysMapping()).isEqualTo(Map.of("temperatureCelsius", "temperature"));
assertThat(defaultConfig.getRenameIn()).isEqualTo(TbMsgSource.DATA);
}
@Test
void givenMsg_whenOnMsg_thenVerifyOutput() throws Exception {
String data = "{\"Temperature_1\":22.5,\"TestKey_2\":10.3}";
node.onMsg(ctx, getTbMsg(deviceId, data));
ArgumentCaptor<TbMsg> newMsgCaptor = ArgumentCaptor.forClass(TbMsg.class);
verify(ctx, times(1)).tellSuccess(newMsgCaptor.capture());
verify(ctx, never()).tellFailure(any(), any());
TbMsg newMsg = newMsgCaptor.getValue();
assertThat(newMsg).isNotNull();
JsonNode dataNode = JacksonUtil.toJsonNode(newMsg.getData());
assertThat(dataNode.has("Attribute_2")).isEqualTo(true);
assertThat(dataNode.has("Temperature_1")).isEqualTo(true);
}
@Test
void givenMetadata_whenOnMsg_thenVerifyOutput() throws Exception {
config = new TbRenameKeysNodeConfiguration().defaultConfiguration();
config.setRenameKeysMapping(Map.of("TestKey_1", "Attribute_1", "TestKey_2", "Attribute_2"));
config.setRenameIn(TbMsgSource.METADATA);
nodeConfiguration = new TbNodeConfiguration(JacksonUtil.valueToTree(config));
node.init(ctx, nodeConfiguration);
String data = "{\"Temperature_1\":22.5,\"TestKey_2\":10.3}";
node.onMsg(ctx, getTbMsg(deviceId, data));
ArgumentCaptor<TbMsg> newMsgCaptor = ArgumentCaptor.forClass(TbMsg.class);
verify(ctx, times(1)).tellSuccess(newMsgCaptor.capture());
verify(ctx, never()).tellFailure(any(), any());
TbMsg newMsg = newMsgCaptor.getValue();
assertThat(newMsg).isNotNull();
Map<String, String> mdDataMap = newMsg.getMetaData().getData();
assertThat(mdDataMap.containsKey("Attribute_1")).isEqualTo(true);
}
@Test
void givenEmptyKeys_whenOnMsg_thenVerifyOutput() throws Exception {
TbRenameKeysNodeConfiguration defaultConfig = new TbRenameKeysNodeConfiguration().defaultConfiguration();
nodeConfiguration = new TbNodeConfiguration(JacksonUtil.valueToTree(defaultConfig));
node.init(ctx, nodeConfiguration);
String data = "{\"Temperature_1\":22.5,\"TestKey_2\":10.3}";
TbMsg msg = getTbMsg(deviceId, data);
node.onMsg(ctx, msg);
ArgumentCaptor<TbMsg> newMsgCaptor = ArgumentCaptor.forClass(TbMsg.class);
verify(ctx, times(1)).tellSuccess(newMsgCaptor.capture());
verify(ctx, never()).tellFailure(any(), any());
TbMsg newMsg = newMsgCaptor.getValue();
assertThat(newMsg).isNotNull();
assertThat(newMsg.getMetaData()).isEqualTo(msg.getMetaData());
}
@Test
void givenMsgDataNotJSONObject_whenOnMsg_thenVerifyOutput() throws Exception {
TbMsg msg = getTbMsg(deviceId, TbMsg.EMPTY_JSON_ARRAY);
node.onMsg(ctx, msg);
ArgumentCaptor<TbMsg> newMsgCaptor = ArgumentCaptor.forClass(TbMsg.class);
verify(ctx, times(1)).tellSuccess(newMsgCaptor.capture());
verify(ctx, never()).tellFailure(any(), any());
TbMsg newMsg = newMsgCaptor.getValue();
assertThat(newMsg).isNotNull();
assertThat(newMsg).isSameAs(msg);
}
private static Stream<Arguments> your_sha256_hashConfig() {
return Stream.of(
Arguments.of(0, "{\"fromMetadata\":false,\"renameKeysMapping\":{\"temp\":\"temperature\"}}", true, "{\"renameIn\":\"DATA\",\"renameKeysMapping\":{\"temp\":\"temperature\"}}"),
Arguments.of(0, "{\"fromMetadata\":true,\"renameKeysMapping\":{\"temp\":\"temperature\"}}", true, "{\"renameIn\":\"METADATA\",\"renameKeysMapping\":{\"temp\":\"temperature\"}}"),
Arguments.of(1, "{\"fromMetadata\":\"METADATA\",\"renameKeysMapping\":{\"temp\":\"temperature\"}}", true, "{\"renameIn\":\"METADATA\",\"renameKeysMapping\":{\"temp\":\"temperature\"}}"),
Arguments.of(1, "{\"fromMetadata\":\"DATA\",\"renameKeysMapping\":{\"temp\":\"temperature\"}}", true, "{\"renameIn\":\"DATA\",\"renameKeysMapping\":{\"temp\":\"temperature\"}}"),
Arguments.of(1, "{\"renameIn\":\"METADATA\",\"renameKeysMapping\":{\"temp\":\"temperature\"}}", false, "{\"renameIn\":\"METADATA\",\"renameKeysMapping\":{\"temp\":\"temperature\"}}"),
Arguments.of(1, "{\"renameIn\":\"DATA\",\"renameKeysMapping\":{\"temp\":\"temperature\"}}", false, "{\"renameIn\":\"DATA\",\"renameKeysMapping\":{\"temp\":\"temperature\"}}")
);
}
@ParameterizedTest
@MethodSource
void your_sha256_hashConfig(int givenVersion, String givenConfigStr,
boolean hasChanges, String expectedConfigStr) throws Exception {
// GIVEN
JsonNode givenConfig = JacksonUtil.toJsonNode(givenConfigStr);
JsonNode expectedConfig = JacksonUtil.toJsonNode(expectedConfigStr);
// WHEN
var upgradeResult = node.upgrade(givenVersion, givenConfig);
// THEN
assertThat(upgradeResult.getFirst()).isEqualTo(hasChanges);
ObjectNode upgradedConfig = (ObjectNode) upgradeResult.getSecond();
assertThat(upgradedConfig).isEqualTo(expectedConfig);
}
private TbMsg getTbMsg(EntityId entityId, String data) {
final Map<String, String> mdMap = Map.of(
"TestKey_1", "Test",
"country", "US",
"city", "NY"
);
return TbMsg.newMsg(TbMsgType.POST_ATTRIBUTES_REQUEST, entityId, new TbMsgMetaData(mdMap), data, callback);
}
}
```
|
Sandra Schaeffer (Bergeson; born in 1946) is an American singer, author and game inventor.
Early career
Schaeffer graduated from North Central College in Naperville, Illinois, in 1968. In 1969 she replaced Madeline Kahn in the off-Broadway musical production of Promenade. She was one of the first college students ever to be hired into the chorus of the Lyric Opera of Chicago (as an alto), and later sang for the New York City Opera as a soprano, and sang a Spanish "zarzuela" directed by Tito Copobianco at City Center. She was a finalist for the lead in Broadway's Man of La Mancha and Two by Two by Richard Rogers.
Comedy
After leaving New York, Schaeffer became a teacher and a mother, and resumed her career in the late 1970s as a singing telegram messenger for the "Hey!Wires" Singing Telegram Company in Chicago. She sang a telegram to President Ronald Reagan on national TV, a performance which included playing "Hail to the Chief" on the kazoo. During the 1970s, she sang the National Anthem for the Chicago Cubs on two occasions. She helped Hey!Wires owner co-write humorous lyrics for singing telegrams. They also co-wrote "The Preppy Comedy Album". Schaeffer wrote a Christmas song, Mrs. Santa, that spoofed being a wife and mother in the late 1970s.
Films
Schaeffer played a lesbian partner in Nothing to Declare, an independent film by Julie Glass, and appeared in Chicago Story and the 2013 Superman, Man of Steel.
Books and games
In 1984, she wrote her first book, The I Hate to Diet Dictionary, excerpts from which appeared in several magazines, including Cosmopolitan and was excerpted in "Like Mother, Like Daughter" from Hyperion Books.. Schaeffer and Balsamo have co-authored two books: Everything You Never Wanted to Know About Sex and The Book of Indecent Proposals.
In 1984, Schaeffer and Balsamo formed TDC Games, a board game company, and produced their first game, entitled "Adultrivia." They have since co-authored hundreds of games and puzzles which are sold worldwide, the most well-known of which is "Dirty Minds." Their games have won awards, have been played on radio and TV (by such personalities as Johnny Carson) and have been on the cover of magazines and newspapers such as The London Times June 20, 1992...front page and "The Washington Post" October 15, 1992 in "Home FronT" with the "Harassment Game." TDC Games, Inc. 1992.
In 2000, Schaeffer won first prize in the Blue Mountain Arts Poetry Contest for a poem dedicated to her late mother. As of 2011 Schaeffer continues to co-create some of the world's most popular board games and jigsaw puzzles.
In 2015, Schaeffer Bergeson's digital art was published in the Somerset magazine, "Digital Studio" as a spotlight on pages 84–86.
References
1946 births
Living people
American musical theatre actresses
North Central College alumni
American women writers
American game designers
21st-century American women
|
The Biscay Regional Championship (Campeonato Regional de Vizcaya), also called the North Regional Championship (Campeonato Regional Norte) in its early editions, was an official football tournament in Spain organised by the North Football Federation.
It was played annually between 1913 and 1940 and served to elect the representatives of the region in the Spanish Cup, which at that time served as the overall annual national championship.
History
The tournament was launched in 1913, following the creation of the North Football Federation (Federación Norte), initially consisting of clubs from the Basque provinces (Biscay, Gipuzkoa and Álava) and Cantabria (then the province of Santander). The first edition of the Northern Regional Championship started on 12 October 1913, with six teams: three from Biscay (Athletic Bilbao, Arenas Club de Getxo and Deportivo de Bilbao) and three from Gipuzkoa (Real Sociedad, Sporting de Irun and Racing de Irun – the latter two would soon merge as Real Unión). Athletic was the first champion.
In 1916 the Royal Spanish Football Federation permitted the clubs from the province of Santander to abandon the North Federation and join the new Cantabrian Regional Federation of Football, along with clubs from the province of Oviedo. But the situation was reversed again two years later.
After several disagreements between the clubs of Biscay and Gipuzkoa, culminating in a pivotal championship match between Athletic and Real Sociedad being abandoned, in 1918 the National Committee of the Spanish federation agreed to divide the Northern Federation in these two regions. Thus, in the 1918–19 season the Gipuzkoa clubs launched their own championship while the North Championship teams continued with other Basque teams and the return of Racing de Santander, representing the Cantabrian clubs.
In 1922 the clubs in the province of Santander finally left the North Federation to create its own umbrella organisation, which launched the Cantabrian Regional Championship. That same year, the Assembly of the Northern Federation agreed to the change of name to the Biscay Federation (Federación Vizcaína), being composed exclusively of clubs from the province (although Deportivo Alavés of Álava also participated in the championship).
In 1934 the Spanish federation undertook a major restructuring of the national tournaments, so that the regional championships were replaced by the superregional, which gathered the best clubs in various regional federations. In the case of the Basque Country, this was called the Basque Cup, launched in season 1934–35. This tournament was held for two years until being interrupted by the Spanish Civil War.
During the last months of the war in 1939, football resumed activity in some areas controlled by the National side, under the impetus of the Spanish Federation and the regional federations. Five teams participated in the reborn Biscay Championship, including its winners Bilbao Athletic (a team formed by Athletic Bilbao, who decided not to use the club's official title as they only had a makeshift squad and were worried about embarrassing results tarnishing their reputation) and runner-up Barakaldo Oriamendi, who both took part in the 1939 Copa del Generalísimo.
The last edition of the Championship of Biscay, which was also a qualifier for access to the 1940 Copa del Generalísimo, was played in the 1939–40 season. Another restructuring approved by the Spanish Federation in 1940 marked the demise of the regional championships.
Winners
Notes
Summary of Champions
Notes
See also
Biscay autonomous football team
History of Athletic Bilbao
References
Martínez Calatrava, Vicente (2001). Historia y estadística del fúbol español.
Defunct football competitions in Spain
Basque football competitions
Sports leagues established in 1913
Sports leagues disestablished in 1940
1913 establishments in Spain
1940 disestablishments in Spain
History of football in Spain
Sport in Biscay
|
The Paul Brown Federal Building and United States Courthouse, also known as Sherman U.S. Federal Building, is a historic government building in Sherman, Texas. It was built during 1906-1907 and reflects Renaissance Revival architecture. The building was listed on the National Register of Historic Places in 2000 as the US Post Office and Courthouse. It served historically as a post office (until 1962) and continues to serve as a federal courthouse for the United States District Court for the Eastern District of Texas. In 2014, the building was renamed in honor of District Judge Paul Neeley Brown.
It is a three-story limestone-clad building on a granite base with a red clay tiled hipped roof.
See also
List of United States federal courthouses in Texas
National Register of Historic Places listings in Grayson County, Texas
Recorded Texas Historic Landmarks in Grayson County
References
External links
Renaissance Revival architecture in Texas
Government buildings completed in 1907
Buildings and structures in Grayson County, Texas
Post office buildings in Texas
Courthouses in Texas
Courthouses on the National Register of Historic Places in Texas
Post office buildings on the National Register of Historic Places in Texas
Federal courthouses in the United States
National Register of Historic Places in Grayson County, Texas
|
```html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>ip::udp::resolver</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../boost_asio.html" title="Boost.Asio">
<link rel="up" href="../ip__udp.html" title="ip::udp">
<link rel="prev" href="protocol.html" title="ip::udp::protocol">
<link rel="next" href="socket.html" title="ip::udp::socket">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
<td align="center"><a href="../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="path_to_url">People</a></td>
<td align="center"><a href="path_to_url">FAQ</a></td>
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="protocol.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ip__udp.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="socket.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="boost_asio.reference.ip__udp.resolver"></a><a class="link" href="resolver.html" title="ip::udp::resolver">ip::udp::resolver</a>
</h4></div></div></div>
<p>
<a class="indexterm" name="boost_asio.indexterm.ip__udp.resolver"></a>
The UDP resolver type.
</p>
<pre class="programlisting">typedef basic_resolver< udp > resolver;
</pre>
<h6>
<a name="boost_asio.reference.ip__udp.resolver.h0"></a>
<span class="phrase"><a name="boost_asio.reference.ip__udp.resolver.types"></a></span><a class="link" href="resolver.html#boost_asio.reference.ip__udp.resolver.types">Types</a>
</h6>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Description
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/endpoint_type.html" title="ip::basic_resolver::endpoint_type"><span class="bold"><strong>endpoint_type</strong></span></a>
</p>
</td>
<td>
<p>
The endpoint type.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/executor_type.html" title="ip::basic_resolver::executor_type"><span class="bold"><strong>executor_type</strong></span></a>
</p>
</td>
<td>
<p>
The type of the executor associated with the object.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/flags.html" title="ip::basic_resolver::flags"><span class="bold"><strong>flags</strong></span></a>
</p>
</td>
<td>
<p>
A bitmask type (C++ Std [lib.bitmask.types]).
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/iterator.html" title="ip::basic_resolver::iterator"><span class="bold"><strong>iterator</strong></span></a>
</p>
</td>
<td>
<p>
(Deprecated.) The iterator type.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/protocol_type.html" title="ip::basic_resolver::protocol_type"><span class="bold"><strong>protocol_type</strong></span></a>
</p>
</td>
<td>
<p>
The protocol type.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/query.html" title="ip::basic_resolver::query"><span class="bold"><strong>query</strong></span></a>
</p>
</td>
<td>
<p>
(Deprecated.) The query type.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/results_type.html" title="ip::basic_resolver::results_type"><span class="bold"><strong>results_type</strong></span></a>
</p>
</td>
<td>
<p>
The results type.
</p>
</td>
</tr>
</tbody>
</table></div>
<h6>
<a name="boost_asio.reference.ip__udp.resolver.h1"></a>
<span class="phrase"><a name="boost_asio.reference.ip__udp.resolver.member_functions"></a></span><a class="link" href="resolver.html#boost_asio.reference.ip__udp.resolver.member_functions">Member
Functions</a>
</h6>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Description
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/async_resolve.html" title="ip::basic_resolver::async_resolve"><span class="bold"><strong>async_resolve</strong></span></a>
</p>
</td>
<td>
<p>
(Deprecated.) Asynchronously perform forward resolution of a
query to a list of entries.
</p>
<p>
Asynchronously perform forward resolution of a query to a list
of entries.
</p>
<p>
Asynchronously perform reverse resolution of an endpoint to a
list of entries.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/basic_resolver.html" title="ip::basic_resolver::basic_resolver"><span class="bold"><strong>basic_resolver</strong></span></a>
</p>
</td>
<td>
<p>
Constructor.
</p>
<p>
Move-construct a basic_resolver from another.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/cancel.html" title="ip::basic_resolver::cancel"><span class="bold"><strong>cancel</strong></span></a>
</p>
</td>
<td>
<p>
Cancel any asynchronous operations that are waiting on the resolver.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/get_executor.html" title="ip::basic_resolver::get_executor"><span class="bold"><strong>get_executor</strong></span></a>
</p>
</td>
<td>
<p>
Get the executor associated with the object.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/get_io_context.html" title="ip::basic_resolver::get_io_context"><span class="bold"><strong>get_io_context</strong></span></a>
</p>
</td>
<td>
<p>
(Deprecated: Use get_executor().) Get the io_context associated
with the object.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/get_io_service.html" title="ip::basic_resolver::get_io_service"><span class="bold"><strong>get_io_service</strong></span></a>
</p>
</td>
<td>
<p>
(Deprecated: Use get_executor().) Get the io_context associated
with the object.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/operator_eq_.html" title="ip::basic_resolver::operator="><span class="bold"><strong>operator=</strong></span></a>
</p>
</td>
<td>
<p>
Move-assign a basic_resolver from another.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/resolve.html" title="ip::basic_resolver::resolve"><span class="bold"><strong>resolve</strong></span></a>
</p>
</td>
<td>
<p>
(Deprecated.) Perform forward resolution of a query to a list
of entries.
</p>
<p>
Perform forward resolution of a query to a list of entries.
</p>
<p>
Perform reverse resolution of an endpoint to a list of entries.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/_basic_resolver.html" title="ip::basic_resolver::~basic_resolver"><span class="bold"><strong>~basic_resolver</strong></span></a>
</p>
</td>
<td>
<p>
Destroys the resolver.
</p>
</td>
</tr>
</tbody>
</table></div>
<h6>
<a name="boost_asio.reference.ip__udp.resolver.h2"></a>
<span class="phrase"><a name="boost_asio.reference.ip__udp.resolver.data_members"></a></span><a class="link" href="resolver.html#boost_asio.reference.ip__udp.resolver.data_members">Data Members</a>
</h6>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Description
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/address_configured.html" title="ip::basic_resolver::address_configured"><span class="bold"><strong>address_configured</strong></span></a>
</p>
</td>
<td>
<p>
Only return IPv4 addresses if a non-loopback IPv4 address is
configured for the system. Only return IPv6 addresses if a non-loopback
IPv6 address is configured for the system.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/all_matching.html" title="ip::basic_resolver::all_matching"><span class="bold"><strong>all_matching</strong></span></a>
</p>
</td>
<td>
<p>
If used with v4_mapped, return all matching IPv6 and IPv4 addresses.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/canonical_name.html" title="ip::basic_resolver::canonical_name"><span class="bold"><strong>canonical_name</strong></span></a>
</p>
</td>
<td>
<p>
Determine the canonical name of the host specified in the query.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/numeric_host.html" title="ip::basic_resolver::numeric_host"><span class="bold"><strong>numeric_host</strong></span></a>
</p>
</td>
<td>
<p>
Host name should be treated as a numeric string defining an IPv4
or IPv6 address and no name resolution should be attempted.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/numeric_service.html" title="ip::basic_resolver::numeric_service"><span class="bold"><strong>numeric_service</strong></span></a>
</p>
</td>
<td>
<p>
Service name should be treated as a numeric string defining a
port number and no name resolution should be attempted.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/passive.html" title="ip::basic_resolver::passive"><span class="bold"><strong>passive</strong></span></a>
</p>
</td>
<td>
<p>
Indicate that returned endpoint is intended for use as a locally
bound socket endpoint.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ip__basic_resolver/v4_mapped.html" title="ip::basic_resolver::v4_mapped"><span class="bold"><strong>v4_mapped</strong></span></a>
</p>
</td>
<td>
<p>
If the query protocol family is specified as IPv6, return IPv4-mapped
IPv6 addresses on finding no IPv6 addresses.
</p>
</td>
</tr>
</tbody>
</table></div>
<p>
The <a class="link" href="../ip__basic_resolver.html" title="ip::basic_resolver"><code class="computeroutput">ip::basic_resolver</code></a>
class template provides the ability to resolve a query to a list of endpoints.
</p>
<h6>
<a name="boost_asio.reference.ip__udp.resolver.h3"></a>
<span class="phrase"><a name="boost_asio.reference.ip__udp.resolver.thread_safety"></a></span><a class="link" href="resolver.html#boost_asio.reference.ip__udp.resolver.thread_safety">Thread Safety</a>
</h6>
<p>
<span class="emphasis"><em>Distinct</em></span> <span class="emphasis"><em>objects:</em></span> Safe.
</p>
<p>
<span class="emphasis"><em>Shared</em></span> <span class="emphasis"><em>objects:</em></span> Unsafe.
</p>
<h6>
<a name="boost_asio.reference.ip__udp.resolver.h4"></a>
<span class="phrase"><a name="boost_asio.reference.ip__udp.resolver.requirements"></a></span><a class="link" href="resolver.html#boost_asio.reference.ip__udp.resolver.requirements">Requirements</a>
</h6>
<p>
<span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/ip/udp.hpp</code>
</p>
<p>
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code>
</p>
</div>
<table xmlns:rev="path_to_url~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
file LICENSE_1_0.txt or copy at <a href="path_to_url" target="_top">path_to_url
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="protocol.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ip__udp.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="socket.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
```
|
```go
// Code generated by smithy-go-codegen DO NOT EDIT.
package ec2
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/service/ec2/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Cancels one or more Spot Instance requests.
//
// Canceling a Spot Instance request does not terminate running Spot Instances
// associated with the request.
func (c *Client) CancelSpotInstanceRequests(ctx context.Context, params *CancelSpotInstanceRequestsInput, optFns ...func(*Options)) (*CancelSpotInstanceRequestsOutput, error) {
if params == nil {
params = &CancelSpotInstanceRequestsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CancelSpotInstanceRequests", params, optFns, c.addOperationCancelSpotInstanceRequestsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CancelSpotInstanceRequestsOutput)
out.ResultMetadata = metadata
return out, nil
}
// Contains the parameters for CancelSpotInstanceRequests.
type CancelSpotInstanceRequestsInput struct {
// The IDs of the Spot Instance requests.
//
// This member is required.
SpotInstanceRequestIds []string
// Checks whether you have the required permissions for the action, without
// actually making the request, and provides an error response. If you have the
// required permissions, the error response is DryRunOperation . Otherwise, it is
// UnauthorizedOperation .
DryRun *bool
noSmithyDocumentSerde
}
// Contains the output of CancelSpotInstanceRequests.
type CancelSpotInstanceRequestsOutput struct {
// The Spot Instance requests.
CancelledSpotInstanceRequests []types.CancelledSpotInstanceRequest
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCancelSpotInstanceRequestsMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsEc2query_serializeOpCancelSpotInstanceRequests{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsEc2query_deserializeOpCancelSpotInstanceRequests{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "CancelSpotInstanceRequests"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = addClientRequestID(stack); err != nil {
return err
}
if err = addComputeContentLength(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = addComputePayloadSHA256(stack); err != nil {
return err
}
if err = addRetry(stack, options); err != nil {
return err
}
if err = addRawResponseToMetadata(stack); err != nil {
return err
}
if err = addRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addTimeOffsetBuild(stack, c); err != nil {
return err
}
if err = addUserAgentRetryMode(stack, options); err != nil {
return err
}
if err = addOpCancelSpotInstanceRequestsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCancelSpotInstanceRequests(options.Region), middleware.Before); err != nil {
return err
}
if err = addRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCancelSpotInstanceRequests(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "CancelSpotInstanceRequests",
}
}
```
|
```html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "path_to_url">
<html xmlns="path_to_url">
<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.10"/>
<title>Introduction_to_Algorithms: GraphADJListTest Class Reference</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="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</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 id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Introduction_to_Algorithms
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<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 Page</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><a href="files.html"><span>Files</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 List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('class_graph_a_d_j_list_test.html','');});
</script>
<div id="doc-content">
<!-- 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="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#pro-methods">Protected Member Functions</a> |
<a href="#pro-attribs">Protected Attributes</a> |
<a href="class_graph_a_d_j_list_test-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">GraphADJListTest Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><a class="el" href="class_graph_a_d_j_list_test.html" title="GraphADJListTest: ">GraphADJListTest</a>:
<a href="class_graph_a_d_j_list_test.html#details">More...</a></p>
<p><code>#include <<a class="el" href="adjlistgraph__test_8h_source.html">adjlistgraph_test.h</a>></code></p>
<div class="dynheader">
Inheritance diagram for GraphADJListTest:</div>
<div class="dyncontent">
<div class="center">
<img src="class_graph_a_d_j_list_test.png" usemap="#GraphADJListTest_map" alt=""/>
<map id="GraphADJListTest_map" name="GraphADJListTest_map">
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a72021ff735af11b1db48290ea0fa8a6b"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_graph_a_d_j_list_test.html#a72021ff735af11b1db48290ea0fa8a6b">SetUp</a> ()</td></tr>
<tr class="separator:a72021ff735af11b1db48290ea0fa8a6b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a79dc8e149913c35045b362c44a5fed46"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_graph_a_d_j_list_test.html#a79dc8e149913c35045b362c44a5fed46">TearDown</a> ()</td></tr>
<tr class="separator:a79dc8e149913c35045b362c44a5fed46"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:afcd2f035a4957685bc697f296bb2b4b5"><td class="memItemLeft" align="right" valign="top">std::shared_ptr< <a class="el" href=your_sha256_hashist_graph.html">ADJListGraph</a>< ADJ_NUM > > </td><td class="memItemRight" valign="bottom"><a class="el" href="class_graph_a_d_j_list_test.html#afcd2f035a4957685bc697f296bb2b4b5">graph</a></td></tr>
<tr class="separator:afcd2f035a4957685bc697f296bb2b4b5"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="class_graph_a_d_j_list_test.html" title="GraphADJListTest: ">GraphADJListTest</a>: </p>
<p><code><a class="el" href="class_graph_a_d_j_list_test.html" title="GraphADJListTest: ">GraphADJListTest</a></code> <code>::testing::Test</code> <code>TEST_F</code> </p>
<p>Definition at line <a class="el" href="adjlistgraph__test_8h_source.html#l00034">34</a> of file <a class="el" href="adjlistgraph__test_8h_source.html">adjlistgraph_test.h</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a72021ff735af11b1db48290ea0fa8a6b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void GraphADJListTest::SetUp </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adjlistgraph__test_8h_source.html#l00039">39</a> of file <a class="el" href="adjlistgraph__test_8h_source.html">adjlistgraph_test.h</a>.</p>
</div>
</div>
<a class="anchor" id="a79dc8e149913c35045b362c44a5fed46"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void GraphADJListTest::TearDown </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adjlistgraph__test_8h_source.html#l00042">42</a> of file <a class="el" href="adjlistgraph__test_8h_source.html">adjlistgraph_test.h</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a class="anchor" id="afcd2f035a4957685bc697f296bb2b4b5"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::shared_ptr<<a class="el" href=your_sha256_hashist_graph.html">ADJListGraph</a><ADJ_NUM> > GraphADJListTest::graph</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p> </p>
<p>Definition at line <a class="el" href="adjlistgraph__test_8h_source.html#l00044">44</a> of file <a class="el" href="adjlistgraph__test_8h_source.html">adjlistgraph_test.h</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>src/graph_algorithms/basic_graph/graph_representation/adjlist_graph/<a class="el" href="adjlistgraph__test_8h_source.html">adjlistgraph_test.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="class_graph_a_d_j_list_test.html">GraphADJListTest</a></li>
<li class="footer">Generated by
<a href="path_to_url">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.10 </li>
</ul>
</div>
</body>
</html>
```
|
Jerry Austin Narron (born January 15, 1956) is an American professional baseball manager, coach, and former player. He most recently served as a major league instructor for the Chicago White Sox. Narron played in MLB, primarily as a catcher, for three teams during 1979–87. He has served as manager for the Texas Rangers (2001–02) and the Cincinnati Reds (2005–07).
He was the third base coach for Israel at the 2017 World Baseball Classic. Narron was also a coach for Team Israel, under manager Ian Kinsler, when it competed in the 2023 World Baseball Classic.
Early years
Narron was born in Goldsboro, North Carolina. He is a Christian Zionist. His father John was employed as a salesman and floor layer for the Isaacs-Kahn Furniture Company in Goldsboro. He is a nephew of former major league catcher and longtime coach Sam Narron.
Through his childhood he played baseball at the Wayne County Boys Club. He attended Goldsboro High School, where he played baseball, basketball, and football, and graduated in 1974. He went to college at East Carolina University.
Playing career
He was drafted out of high school when he was 18 years old by the New York Yankees in the sixth round of the 1974 Major League Baseball Draft. He played alongside brother Johnny for the Johnson City Cardinals in the Rookie Appalachian League during his first professional season in 1974, batting .301/.415/.487 with 15 doubles (3rd in the league), 7 home runs (10th), and 49 RBIs (6th). In 1977, playing for the West Haven Yankees of the AA Eastern League, he batted .299 (eighth in the league)/.376/.527(third) with 80 runs (sixth), 28 home runs (second) and 93 RBIs (third) in 438 at bats.
He made his major league debut on April 13, 1979. Narron played for the Yankees as the backup catcher to Thurman Munson. He was the Yankees' starting catcher the day after Munson's death in a plane crash in August 1979, and remained in the dugout during the pregame ceremonies, leaving the catcher's position empty, out of respect for Munson.
In November 1979 Narron was traded by the Yankees to the Seattle Mariners with Juan Beniquez, Rick Anderson, and Jim Beattie for Jim Lewis and Ruppert Jones.
He was released by the Mariners in March 1982, and signed two days later as a free agent by the California Angels. Playing for the Spokane Indians in the AAA Pacific Coast League (PCL) in 1982, he batted .311/.381/.468 in 408 at bats. In 1983, playing for the Edmonton Trappers of the PCL, he batted .301/.377/.528 with 30 doubles (eighth in the league), 27 home runs (fourth) and 102 RBIs (fifth) in 539 at bats, while leading the league with 15 intentional walks. He was released by the Angels in April 1987, and signed later that month by the Seattle Mariners, who in turn released him the following November. He retired as a player in 1989.
Managing and coaching history
Minor and major leagues
Narron was a manager in the Baltimore Orioles farm system from 1989 through 1992; of the Single–A Frederick Keys (1989), Double–A Hagerstown Suns (1990-91), and Triple–A Rochester Red Wings (1992), with a record of 291-269 (.520). He was then hired as a coach for the Orioles by skipper Johnny Oates.
After two seasons in Baltimore, he moved with Oates to the Texas Rangers. Narron was third-base coach for the Rangers from 1995 until he was named interim manager on May 4, 2001, after the firing of manager Johnny Oates. He had the interim tag removed and managed the team during the 2002 season. He was replaced in Texas by Buck Showalter in December 2002.
Narron then served as bench coach for the Boston Red Sox during their 2003 run to the American League Championship Series. He performed the same role for Cincinnati in 2004–05.
Narron was named the Reds' interim manager on June 20, 2005. On September 29 of that year, his contract was extended to cover the 2006 season with a mutual option for 2007. Narron was fired as manager of the Reds on July 1, 2007. The Reds named advance scout Pete Mackanin as the interim manager. Narron's record with the Reds was 157–179.
On February 25, 2008, Narron was named a special assignments scout and front-office consultant with the Rangers.
Narron served as bench coach for the Milwaukee Brewers from 2011 to 2015.
Narron was hired to be the 2017 manager of the Reno Aces on December 30, 2016.
After the first seven games of the 2017 season, Narron took over as interim bench coach of the major league Arizona Diamondbacks, when bench coach Ron Gardenhire left the team on a leave of absence to have and recover from prostate cancer surgery. Narron got the job permanently after Gardenhire was hired to be the Detroit Tigers' manager. Narron stepped down from his position as bench coach of the Diamondbacks following the 2019 season.
Narron was hired as bench coach for the Boston Red Sox on February 22, 2020. In October 2020, the team declined to renew his contract.
On February 10, 2021, Narron was hired as a major league instructor for the Chicago White Sox. On November 2, 2022, Narron and the White Sox parted ways.
Currently, the Los Angeles Angels have hired Jerry Narron as a catching coordinator in their minor-league player development.
Team Israel; World Baseball Classic
Narron was the third base coach for Israel at the 2017 World Baseball Classic qualifier. Narron, whose daughter Callie lives in the Arnona neighborhood of Jerusalem, Israel, with her husband and two children, said: "I love the game, I love the Jewish people and I love Israel".
Narron was again a coach for Team Israel, under manager Ian Kinsler, when it competed in the 2023 World Baseball Classic.
Managerial records
Personal life
Narron is married to Donna Narron. He has five children and two stepchildren: Connor, Cara, Clare, Caitlyn, Callie, Chelsy, Coco and Hunter. His son Connor was the fourth-ranked prospect for the high school class of 2010 by ESPN's Perfect Game. The Orioles selected Connor in the fifth round of the 2010 MLB draft; he played in Minor League Baseball during the 2010 to 2014 seasons. Narron's brother Johnny was the hitting coach for the Milwaukee Brewers from 2012 to 2014. Narron is the nephew of former major league catcher and coach Sam W. Narron and cousin of pitcher Sam F. Narron.
Narron is known for writing out lineup cards using a distinct form of calligraphy, and for rendering the names of players from Japan, Korea and Taiwan in their native scripts on the lineup cards.
References
External links
1956 births
Living people
American expatriate baseball players in Canada
Arizona Diamondbacks coaches
Baltimore Orioles coaches
Baseball coaches from North Carolina
Baseball players from North Carolina
Boston Red Sox coaches
Calgary Cannons players
California Angels players
Chicago White Sox coaches
Cincinnati Reds coaches
Cincinnati Reds managers
East Carolina Pirates baseball players
Edmonton Trappers players
Fort Lauderdale Yankees players
Johnson City Yankees players
Major League Baseball bench coaches
Major League Baseball catchers
Major League Baseball third base coaches
Milwaukee Brewers coaches
Minor league baseball managers
New York Yankees players
Sportspeople from Goldsboro, North Carolina
Reno Aces players
Rochester Red Wings managers
Rochester Red Wings players
Seattle Mariners players
Spokane Indians players
Tacoma Yankees players
Texas Rangers managers
West Haven Yankees players
|
```shell
How to change your most recent commit
Pushing tags to a server
Limiting log output by time
Search for commits by author
Dates in git
```
|
```java
/*
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package org.apache.rocketmq.acl.common;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.rocketmq.acl.plain.PlainAccessResource;
import org.junit.Assert;
import org.junit.Test;
public class PermissionTest {
@Test
public void fromStringGetPermissionTest() {
byte perm = Permission.parsePermFromString("PUB");
Assert.assertEquals(perm, Permission.PUB);
perm = Permission.parsePermFromString("SUB");
Assert.assertEquals(perm, Permission.SUB);
perm = Permission.parsePermFromString("PUB|SUB");
Assert.assertEquals(perm, Permission.PUB|Permission.SUB);
perm = Permission.parsePermFromString("SUB|PUB");
Assert.assertEquals(perm, Permission.PUB|Permission.SUB);
perm = Permission.parsePermFromString("DENY");
Assert.assertEquals(perm, Permission.DENY);
perm = Permission.parsePermFromString("1");
Assert.assertEquals(perm, Permission.DENY);
perm = Permission.parsePermFromString(null);
Assert.assertEquals(perm, Permission.DENY);
}
@Test
public void checkPermissionTest() {
boolean boo = Permission.checkPermission(Permission.DENY, Permission.DENY);
Assert.assertFalse(boo);
boo = Permission.checkPermission(Permission.PUB, Permission.PUB);
Assert.assertTrue(boo);
boo = Permission.checkPermission(Permission.SUB, Permission.SUB);
Assert.assertTrue(boo);
boo = Permission.checkPermission(Permission.PUB, (byte) (Permission.PUB|Permission.SUB));
Assert.assertTrue(boo);
boo = Permission.checkPermission(Permission.SUB, (byte) (Permission.PUB|Permission.SUB));
Assert.assertTrue(boo);
boo = Permission.checkPermission(Permission.ANY, (byte) (Permission.PUB|Permission.SUB));
Assert.assertTrue(boo);
boo = Permission.checkPermission(Permission.ANY, Permission.SUB);
Assert.assertTrue(boo);
boo = Permission.checkPermission(Permission.ANY, Permission.PUB);
Assert.assertTrue(boo);
boo = Permission.checkPermission(Permission.DENY, Permission.ANY);
Assert.assertFalse(boo);
boo = Permission.checkPermission(Permission.DENY, Permission.PUB);
Assert.assertFalse(boo);
boo = Permission.checkPermission(Permission.DENY, Permission.SUB);
Assert.assertFalse(boo);
}
@Test(expected = AclException.class)
public void setTopicPermTest() {
PlainAccessResource plainAccessResource = new PlainAccessResource();
Map<String, Byte> resourcePermMap = plainAccessResource.getResourcePermMap();
Permission.parseResourcePerms(plainAccessResource, false, null);
Assert.assertNull(resourcePermMap);
List<String> groups = new ArrayList<>();
Permission.parseResourcePerms(plainAccessResource, false, groups);
Assert.assertNull(resourcePermMap);
groups.add("groupA=DENY");
groups.add("groupB=PUB|SUB");
groups.add("groupC=PUB");
Permission.parseResourcePerms(plainAccessResource, false, groups);
resourcePermMap = plainAccessResource.getResourcePermMap();
byte perm = resourcePermMap.get(PlainAccessResource.getRetryTopic("groupA"));
Assert.assertEquals(perm, Permission.DENY);
perm = resourcePermMap.get(PlainAccessResource.getRetryTopic("groupB"));
Assert.assertEquals(perm,Permission.PUB|Permission.SUB);
perm = resourcePermMap.get(PlainAccessResource.getRetryTopic("groupC"));
Assert.assertEquals(perm, Permission.PUB);
List<String> topics = new ArrayList<>();
topics.add("topicA=DENY");
topics.add("topicB=PUB|SUB");
topics.add("topicC=PUB");
Permission.parseResourcePerms(plainAccessResource, true, topics);
perm = resourcePermMap.get("topicA");
Assert.assertEquals(perm, Permission.DENY);
perm = resourcePermMap.get("topicB");
Assert.assertEquals(perm, Permission.PUB|Permission.SUB);
perm = resourcePermMap.get("topicC");
Assert.assertEquals(perm, Permission.PUB);
List<String> erron = new ArrayList<>();
erron.add("");
Permission.parseResourcePerms(plainAccessResource, false, erron);
}
@Test
public void checkAdminCodeTest() {
Set<Integer> code = new HashSet<>();
code.add(17);
code.add(25);
code.add(215);
code.add(200);
code.add(207);
for (int i = 0; i < 400; i++) {
boolean boo = Permission.needAdminPerm(i);
if (boo) {
Assert.assertTrue(code.contains(i));
}
}
}
@Test
public void AclExceptionTest(){
AclException aclException = new AclException("CAL_SIGNATURE_FAILED",10015);
AclException aclExceptionWithMessage = new AclException("CAL_SIGNATURE_FAILED",10015,"CAL_SIGNATURE_FAILED Exception");
Assert.assertEquals(aclException.getCode(),10015);
Assert.assertEquals(aclExceptionWithMessage.getStatus(),"CAL_SIGNATURE_FAILED");
aclException.setCode(10016);
Assert.assertEquals(aclException.getCode(),10016);
aclException.setStatus("netaddress examine scope Exception netaddress");
Assert.assertEquals(aclException.getStatus(),"netaddress examine scope Exception netaddress");
}
}
```
|
```objective-c
#ifndef _IOMAN_ADD_H_
#define _IOMAN_ADD_H_
#include <iox_stat.h>
#define IOP_DT_FSEXT 0x10000000
typedef struct _iop_ext_device
{
const char *name;
unsigned int type;
unsigned int version; /* Not so sure about this one. */
const char *desc;
struct _iop_ext_device_ops *ops;
} iop_ext_device_t;
typedef struct _iop_ext_device_ops
{
int (*init)(iop_device_t *);
int (*deinit)(iop_device_t *);
int (*format)(iop_file_t *);
int (*open)(iop_file_t *, const char *, int);
int (*close)(iop_file_t *);
int (*read)(iop_file_t *, void *, int);
int (*write)(iop_file_t *, void *, int);
int (*lseek)(iop_file_t *, int, int);
int (*ioctl)(iop_file_t *, unsigned long, void *);
int (*remove)(iop_file_t *, const char *);
int (*mkdir)(iop_file_t *, const char *);
int (*rmdir)(iop_file_t *, const char *);
int (*dopen)(iop_file_t *, const char *);
int (*dclose)(iop_file_t *);
int (*dread)(iop_file_t *, iox_dirent_t *);
int (*getstat)(iop_file_t *, const char *, iox_stat_t *);
int (*chstat)(iop_file_t *, const char *, iox_stat_t *, unsigned int);
/* Extended ops start here. */
int (*rename)(iop_file_t *, const char *, const char *);
int (*chdir)(iop_file_t *, const char *);
int (*sync)(iop_file_t *, const char *, int);
int (*mount)(iop_file_t *, const char *, const char *, int, void *, unsigned int);
int (*umount)(iop_file_t *, const char *);
long long (*lseek64)(iop_file_t *, long long, int);
int (*devctl)(iop_file_t *, const char *, int, void *, unsigned int, void *, unsigned int);
int (*symlink)(iop_file_t *, const char *, const char *);
int (*readlink)(iop_file_t *, const char *, char *, unsigned int);
int (*ioctl2)(iop_file_t *, int, void *, unsigned int, void *, unsigned int);
} iop_ext_device_ops_t;
#endif
```
|
Çimenli () is a village in the Tunceli District, Tunceli Province, Turkey. The village is populated by Kurds of the Maskan tribe and had a population of 141 in 2021.
The hamlets of Çukurbağ and Kalkar are attached to the village.
References
Villages in Tunceli District
Kurdish settlements in Tunceli Province
|
Soundscraper is the eighth studio album by Praga Khan. It was released in 2006.
Track listing
"Heal Me" – 7:30
"We Fuel Our Own High" – 3:53
"Pick-Up Truck" – 5:38
"Right or Wrong" – 4:52
"Don't U Tell Me" – 4:29
"Picasso’s Dream" – 6:31
"Earth & Space" – 3:40
"United in Love" – 4:39
"Sweet Angel Ice" – 3:38
"China Lady" – 6:41
"You Break My Heart" – 4:22
Notes
2006 albums
Praga Khan albums
|
```java
/*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package org.springframework.samples.petclinic.model;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
/**
* Simple JavaBean domain object with an id property. Used as a base class for objects needing this property.
*
* @author Ken Krebs
* @author Juergen Hoeller
*/
@MappedSuperclass
public class BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
protected Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public boolean isNew() {
return this.id == null;
}
}
```
|
Sir Thomas Hilton (by 1500 – 1559) was an English politician.
He was the eldest son of Sir William Hilton, de jure 9th Lord Hilton. He was knighted in 1523 and succeeded his father as de jure 10th Lord Hilton by 1537.
He was appointed High Sheriff of Durham for 1532–33 and 1533–34 and High Sheriff of Northumberland for 1543–44 and 1549–50.
He was a Member (MP) of the Parliament of England for Northumberland in 1547.
He married four times: firstly Elizabeth, the daughter and coheiress of John Clervaux of Croft, Yorkshire; secondly Anne, the daughter of Sir Clement Harleston of South Ockendon, Essex, and widow of Nicholas Lambert of Owlton, County Durham; thirdly Elizabeth, the daughter and heiress of Sir Henry Boynton of Sedbury, Yorkshire and widow of Sir Henry Gascoigne of Sedbury; and fourthly Agnes, the daughter and heiress of John Ifield and widow of Matthew Baxter of Newcastle.
References
1559 deaths
English MPs 1547–1552
High Sheriffs of Durham
High Sheriffs of Northumberland
Year of birth uncertain
|
```xml
import { FontSizes, FontWeights, HighContrastSelector, HighContrastSelectorBlack } from '@fluentui/react';
import { IGaugeChartStyleProps, IGaugeChartStyles } from './GaugeChart.types';
export const getStyles = (props: IGaugeChartStyleProps): IGaugeChartStyles => {
const { theme, chartValueSize, chartWidth, chartHeight, className, lineColor, toDrawShape } = props;
return {
root: [
theme.fonts.medium,
'ms-GaugeChart',
{
width: '100%',
height: '100%',
},
className,
],
chart: {
display: 'block',
width: chartWidth,
height: chartHeight,
},
limits: {
fontSize: FontSizes.small,
fontWeight: FontWeights.semibold,
fill: theme.palette.neutralPrimary,
},
chartValue: {
fontSize: chartValueSize,
fontWeight: FontWeights.semibold,
fill: theme.palette.neutralPrimary,
},
sublabel: {
fontSize: FontSizes.small,
fontWeight: FontWeights.semibold,
fill: theme.palette.neutralPrimary,
},
needle: {
fill: theme.palette.black,
stroke: theme.semanticColors.bodyBackground,
},
chartTitle: {
fontSize: FontSizes.small,
fill: theme.palette.neutralPrimary,
},
segment: {
outline: 'none',
stroke: theme.semanticColors.focusBorder,
},
legendsContainer: {
width: chartWidth,
},
calloutContentRoot: [
{
display: 'grid',
overflow: 'hidden',
padding: '11px 16px 10px 16px',
backgroundColor: theme.semanticColors.bodyBackground,
backgroundBlendMode: 'normal, luminosity',
},
],
calloutDateTimeContainer: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
},
calloutContentX: [
{
...theme.fonts.small,
lineHeight: '16px',
opacity: '0.85',
color: theme.semanticColors.bodySubtext,
},
],
calloutBlockContainer: [
theme.fonts.mediumPlus,
{
marginTop: '13px',
color: theme.semanticColors.bodyText,
},
!toDrawShape && {
selectors: {
[HighContrastSelector]: {
forcedColorAdjust: 'none',
},
},
borderLeft: `4px solid ${lineColor}`,
paddingLeft: '8px',
},
toDrawShape && {
display: 'flex',
},
],
shapeStyles: {
marginRight: '8px',
},
calloutlegendText: {
...theme.fonts.small,
lineHeight: '16px',
selectors: {
[HighContrastSelectorBlack]: {
color: 'rgb(255, 255, 255)',
},
},
color: theme.semanticColors.bodySubtext,
},
calloutContentY: [
{
...theme.fonts.mediumPlus,
fontWeight: 'bold',
lineHeight: '22px',
selectors: {
[HighContrastSelectorBlack]: {
color: 'rgb(255, 255, 255)',
},
},
},
],
descriptionMessage: [
theme.fonts.small,
{
selectors: {
[HighContrastSelectorBlack]: {
color: 'rgb(255, 255, 255)',
},
},
color: theme.semanticColors.bodyText,
marginTop: '10px',
paddingTop: '10px',
borderTop: `1px solid ${theme.semanticColors.menuDivider}`,
},
],
};
};
```
|
Horma is a village in Võru Parish, Võru County in Estonia.
References
Villages in Võru County
|
Bactrocythara cryera is a species of sea snail, a marine gastropod mollusk in the family Mangeliidae.
Description
The length of the shell attains 5 mm, its diameter 2.1 mm.
Distribution
This marine species is distributed in the Western Atlantic, mainly from Georgia to Florida, USA at depths between 538 m and 805 m
References
Dall W. H. (1927). Small shells from dredgings off the southeast coast of the United states by the United States Fisheries Steamer "Albatross", in 1885 and 1886; Proceedings of the United States National Museum, 70(18): 1–134
External links
Tucker, J.K. 2004 Catalog of recent and fossil turrids (Mollusca: Gastropoda). Zootaxa 682:1–1295.
Bouchet P., Kantor Yu.I., Sysoev A. & Puillandre N. (2011) A new operational classification of the Conoidea. Journal of Molluscan Studies 77: 273–308.
cryera
Gastropods described in 1927
|
Lopp Lagoon (Inupiaq: Taziq) is a tidal lake NE of Cape Prince of Wales (the westernmost tip of the Seward Peninsula) in the U.S. state of Alaska. Many creeks empty into it, but the most water comes from the Mint River. Some salt water from the Pacific Ocean also enters the lagoon through several channels between it and the Bering Strait.
It was named in 1900 for William Thomas Lopp, a missionary among the Inuit and the civilian leader of the 1897–98 Overland Relief Expedition.
Historically, Lopp Lagoon has been an important source of food (salmon and waterfowl) for people living in the Wales, Alaska area.
Further reading
Smith, Kathleen Lopp, Ed. Ice Window: Letters from a Bering Strait Village, 1892-1902. Juneau, Alaska: University of Alaska Press, 2002.
Lakes of Alaska
Bodies of water of Nome Census Area, Alaska
Bodies of water of the Seward Peninsula
|
Jewlia Eisenberg (1970/1 – March 11, 2021) was an American singer, composer, bassist, educator, and cantor. As founder and bandleader of Charming Hostess she coined the term "Nerdy-Sexy-Commie-Girly" to describe her genre of music which spans an eclectic range of styles.
Originally from New York City, Eisenberg became an integral member of the San Francisco Bay Area and the New York Downtown music scenes in the 1990s.
Her music was both physical, using voices, vocal percussion, handclaps, heartbeats, sex-breath, silence, and also intellectual, exploring such topics as Bosnian genocide in Sarajevo Blues (2004) and the political/erotic nexus of Walter Benjamin and his Marxist muse in Trilectic (2002). Both of these works were released on John Zorn's Radical Jewish Series on Tzadik.
She was commissioned from such sources as by the Sloan Foundation and the Goethe Institut SF and has received numerous awards, including: Trust for Mutual Understanding grant for collaboration with poets in ex-Yugoslavia, the Puffin Foundation grant for her Red Rosa project, a Katzenstein Fellow for collaboration with experimental architects and engineers as an Artist-In-Residence at MIT, a Rockefeller Foundation Multi-Arts Production Fund Grant for 'The Grim Arithmetic of Water, with aerial dance choreographer Jo Kreiter, a Goldman Fund Tikea Fellow for project-based radical film and music work with youth, and a Weisz Fellow for field research and recording among Jewish women in the Gondar region of Ethiopia. Eisenberg enjoyed a retreat as part of the Djerassi Resident Artists Program in October–November 2006.
Early life
Eisenberg was born in Brooklyn, New York, and grew up in Starrett City. Her parents were communists, and she stated that she lived with them in "a commune that was for black and Jewish people". Eisenberg's mother was a musician, who encouraged her musical development.
Eisenberg studied music at UC Berkeley, and later travelled the world. She also studied at the Pardes Institute of Jewish Studies.
Early work
Eisenberg's music got a kick-start at University of California in Barrington Hall. It was there that she founded the first incarnation of Charming Hostess. At that time the West Oakland scene was also home to bands such as Fibulator and Eskimo. Half of the members of Charming Hostess were also in Idiot Flesh and Sleepytime Gorilla Museum. Eisenberg has described the genre of early Charming Hostess as "klezmer-punk/balkan-funk". Members included Jewlia Eisenberg (voice, direction), Carla Kihlstedt (voice, fiddle), Nina Rolle (voice, accordion), Wes Anderson (drums), Nils Frykdahl (guitar, flute, saxophone, percussion), and Dan Rathbun (bass).
Illness and death
Eisenberg died on March 11, 2021, of complications from a rare immune disorder known as GATA2 deficiency. News of the artist's death was announced on her social media page later that day.
Discography as leader
Book of J, self-titled. (3rd Generation Records, 2018)
The Bowls Project, as Charming Hostess. (Tzadik Records, Radical Jewish Culture, 2010)
Punch, as Charming Hostess. (Recommended Records, 2005)
Sarajevo Blues, as Charming Hostess. (Tzadik Records, Radical Jewish Culture, 2004)
Thick, with Red Pocket. (Tzadik Records, Oracle Women's Series, 2004)
Trilectic, (Tzadik Records, Radical Jewish Culture, 2002)
Eat, as Charming Hostess. (Vaccination Records, 1998)
Contributions
John Zorn: Masada Anniversary Edition Vol. 2: Voices in the Wilderness. (Tzadik Records, Radical Jewish Culture, 2003)
Various Artists : Great Jewish Music: Sasha Argov. (Tzadik Records, Radical Jewish Culture, 2003)
References
External links
Official Charming Hostess web site
Listening
Jewlia Eisenberg/Jeremiah Lockwood Live performance and interview NYC Radio Live Podcast, July 2018
Jewlia Eisenberg interview. BBC's The World - by Benjamin Temchine, Sept 2005.
1970s births
Year of birth uncertain
2021 deaths
American women composers
21st-century American composers
21st-century American women musicians
21st-century women composers
Jewish American musicians
Composers from New York City
|
Military rations, operational rations, or military provisions are goods issued to sustain the needs of military personnel. As their name suggests, military rations have historically been, and often still are, subject to rationing, with each individual receiving specific amounts from available supplies. Military-issued goods and the rationing of such goods has existed since the beginnings of organized warfare.
Though commonly referring to food and drink rations, "military ration" may also refer to other types of items that are rationed for military personnel, such as fuel, alcohol, expensive items, or consumer goods. Ration acquisition may be managed using allowances or a ration card, or they may be issued without charge.
Military rations are a key component of military nutrition, the field and study of nutrition in the military. Significant research goes into creating military rations, including the nutrition and energy of rations, food spoilage prevention, what meals should be offered, the amount of food each ration should contain, and the exact specifications of each meal and ingredient.
Types
Field ration
A field ration (known under a variety of other names) is a military ration intended to provide nutrition and sustenance in the field, in combat, at the front line, or where eating facilities are otherwise unavailable.
Field rations can be categorized into two main types:
Individual rations, designed and intended to sustain a single person
Group rations, designed and intended to sustain multiple personnel
Garrison ration
A garrison ration is a type of military ration that, depending on its use and context, could refer to rations issued to personnel at a camp, installation, or other garrison; allowance allotted to personnel to purchase goods or rations sold in a garrison (or the rations purchased with allowance); a type of ration; or a combined system with distinctions and differences depending on situational factors (such as whether the country is at peace or at war).
History
Ancient and antiquity
In ancient warfare, militaries generally lived off the land, relying on whatever food they could forage, steal, purchase, or requisition.
In Mesopotamia, most workers, including soldiers, were given rations of barley, oil, and wool. In ancient Egypt, soldiers brought whatever they could carry in battle, but ate well while in their camps. In ancient Rome, soldiers relied on wheat, which was replaced with barley as punishment. Each soldier had an allotted amount of food they could have, such as one pound of meat daily; the size of a Roman legion meant dozens, if not hundreds of animals could be killed daily to sustain their needs. Chinese soldiers of the Han dynasty ate rice, wheat, sorghum, and other grains, smashed and fried in a manner similar to modern fried rice and fried noodles. Soldiers of the Byzantine Empire were trained in sustaining their food supplies for as long as 20 days, with many also carrying small hand mills to grind grain to make paximathia.
Post-classical
In medieval warfare, military feeding remained essentially the same as it had been in prior centuries.
Tang dynasty soldiers ate primarily millet porridge, but before a deployment, they would have a large and elaborate banquet, with another large meal before a battle. During the Crusades, crusaders brought grain with them, but otherwise relied on their own food storages, purchased food from locals and, by the late Crusades, supplies brought in by Venetian vessels and merchants. However, their food supplies were consistently low, to the point that in several battles crusaders would "stop fighting and start eating" upon discovering food in the camps of Muslim armies. The armies of the Mongol Empire only had whatever food or livestock they brought from home, and relied on whatever food they could pillage. Ottoman Empire Janissaries were some of the most well-fed soldiers of the era, with access to a variety of foods. The Ottoman military greatly relied on bread and biscuits, with around 105 ovens in Istanbul dedicated solely to baking for military purposes.
In feudal Japan and the Sengoku period, military nutrition habits depended on the daimyo commanding them:
Mōri Motonari issued each soldier a bag of rice, fried rice, and mochi, the latter of which was chosen due to its portability, long shelf life, ability to provide high energy in small amounts, and Motonari's personal preference for it.
Uesugi Kenshin would prepare massive feasts for his army before battles, known as kachidoki-meshi ("victory cry meals"), featuring delicacies such as "a mountain of rice ... black-boiled abalone, vinegar-washed fish and jellyfish sashimi, soups with seasonal vegetables and dried fish, walnut-roasted duck, simmered sand borer, and more", though Kenshin himself was noted to eat very little. During battles, Kenshin assembled supply convoys called konidatai staffed by peasants, who would deliver supplies and rations to troops.
Toyotomi Hideyoshi is said to have regularly distributed food rations out to his officers and soldiers, and kept them well-fed. In one instance, while traveling from Ogaki to Nagahama (a 52 kilometer distance) in 1583, Hideyoshi sent scouts ahead to each village to ask that they prepare rice for Hideyoshi's army; the villages set out rice balls for the soldiers, allowing them to remain fed for the entire trip.
In general, Japanese soldiers would bring uchigaibukuro, pouches used to store rice and medicine, into battle with them. They would also eat miso, dried taro stalk, and okayu as part of a soup prepared in a soldier's jingasa. Soldiers and ninja also used "pills", small ball-shaped medicinal rations consumed in emergencies or long missions, of which there were three types: hyorogan ("ration pills"), made with various flours, sugary substances, and spices to provide quick energy; kikatsugan ("hunger pills"), made with starchy ingredients to provide endurance; and suikitsugan ("thirst pills"), made from umeboshi, bakumondoto, and sugar to encourage saliva production.
Song dynasty soldiers were issued money to buy food, pickles, salt, and other food items, though grain supply issues meant they relied less on grain rations than in prior generations. By the Ming dynasty, sesame seed cakes, which could last long periods of time, became standard military food; additionally, the imperial government spent significant amounts of money on the military, ensuring they had plenty of food.
Early modern
By the era of early modern warfare, military food had improved to a relatively significant degree.
The British Empire's Royal Navy relied on hardtack, salted meat, and alcoholic drinks (originally beer but later rum). The Continental Army of the Revolutionary War-era United States had, on paper, plentiful rations including salted meat, legumes, grains, bread, milk, and alcohol, with jerky and hardtack if those foods were not available. However, in reality, the Continental Army had difficulties supplying their units, and soldiers reportedly had to beg civilians for food. The situation deteriorated to the point that the U.S. Congress pressured George Washington to permit the seizure of food, but he declined, fearing it would alienate the colonials.
During the Napoleonic Wars, the Grande Armée strongly relied on bread—24 ounces standard if well-supplied, compared to a mere half-pound of meat and 2 ounces of legumes—but "spent most of their time desperately hungry", relying on doughboys and "out of the ground" crops such as potatoes and corn, which required minimal cooking and had recently become common across European farms.
During French and Indian War, a theatre of the Seven Years' War, the British had a detailed ration system. The Crimean War saw issues with supplying soldiers in battle. In the British Army, rations were regularly halved, and many soldiers developed scurvy, to the point that the hospital in Scutari received more soldiers for scurvy than battle wounds. During the American Civil War, the food and rations of the Union Army and the Confederate States Army were meant to be mostly the same—meat, cornmeal, vegetables, vinegar, molasses, and hardtack—but supply issues plagued the Confederates as the war continued, forcing them to live off the land.
Shortly before the Napoleonic Wars, French government offered a 12,000 franc reward to invent a reliable food preservation method for the military. Nicolas Appert, a French confectioner operating a food bottling factory in Massy, Essonne, offered his bottling method and published a book detailing the process in 1810. Appert's bottling method was later developed into canning, improved when Peter Durand invented the tin can the same year, which became the standard for storing food using Appert's method. The development of pasteurization by Louis Pasteur also improved military rations.
Modern
The era of modern warfare saw significant improvements in the shelf life, variety, and quality of military rations and nutrition.
In World War I, both Allied and Central Powers soldiers had relatively sufficient food supplies due to the static nature of trench warfare. British, French, Canadian, and ANZAC soldiers were regularly issued "dull" foods such as bully beef, biscuits, pudding, and Maconochie (tinned meat, potato, and vegetable stew), the latter of which was panned for its poor quality, especially if not sufficiently heated. British Indian Army soldiers reportedly ate very well compared to their European comrades, with regular access to fresh food such as goat meat and rotis; British logistics also accommodated for vegetarian Indians by providing them with dal, gur, and milk instead of meat. This treatment was supposedly to prevent a mutiny similar to the Indian Rebellion of 1857, which was partially caused by indifference to Indian religious needs. The American Expeditionary Forces had a variety of different rations issued to them, organized based on freshness and purpose, and were generally considered well-fed compared to their British Empire contemporaries. Imperial German Army soldiers had mostly the same things, but with reliance on potatoes over grains. As the war progressed and food supplies lowered due to restrictions, the German military was forced to gradually reduce their meat rations, instituting meat-free days once per week and making meat a rarity among German soldiers.
By World War II, rations had taken modern organized forms for both the Allies and the Axis. The U.S. military revised their World War I-era ration organization system into an alphabetized system: A-rations of fresh food, B-rations of packaged unprepared food, C-rations of prepared canned food, D-rations of chocolate, and K-rations of three-course meals. British soldiers were issued 24-hour rations intended to sustain troops until composite rations and fresh food could be supplied by field kitchens. On the home front in Britain, mobile canteens were operated to feed Home Guard and civil defence authorities hot food and fresh tea. Red Army soldiers received rye bread, potatoes, vegetables, pasta, meat, and fish (in order of quantity). The Chinese Second United Front had ample food supplies, but food was strained after 1940, when food panics and requirements for peasants to feed Chinese soldiers led to agricultural failures and severe inflation. The German Wehrmacht received basic rations of hard bread and canned meat (usually pork, roast beef, turkey, or chicken, though Fleischkonserve—literally translated as "can of meat"—went unidentified), though canned tomato soup, condensed milk, and Erbswurst (a compact peasemeal sausage that can be dissolved to make pea soup) were also common. Elite units such as the Fallschirmjäger received more unique high-energy food, including tins of cheese and sausage. The Schutzstaffel received four-day rations consisting of Graubrot, canned meat, vegetables, spreads, coffee, and cigarettes (despite the SS's strong anti-smoking stance). Regions invaded and occupied by Nazi forces were stripped of their food to feed Germans and starve local populations. The Imperial Japanese Army and Navy received rather basic rations that were intended to be eaten alongside other foraged food. The Royal Italian Army ate mainly pasta, bread, oatmeal, meat, fish, broth, and salad from their field kitchens, with alcohol also regularly issued. However, on deployment, Italian soldiers mostly received low-quality canned food and biscuits, with regular supplies of food strained by logistical issues during the North African campaign.
Most modern and currently-issued rations were developed during and after the Cold War. The Soviet Armed Forces issued their personnel a very basic ration of tushonka, bread or crackers, and condensed milk, with little variety. Both the West German Bundeswehr and the East German National People's Army issued 24-hour rations containing four meals each, though their contents and types varied. The U.S. military, initially issuing the canned Meal, Combat, Individual (similar to the C-ration) from the late 1950s through the Vietnam War, developed the Meal, Ready-to-Eat (MRE) in 1983, designed to provide easy-to-prepare individual meals in retort pouches that could last for very long periods of time. The British 24-hour ration gradually advanced from tinned rations to freeze-dried and vacuum-sealed rations.
See also
Armed Forces Recipe Service
Army Catering Corps
History of military nutrition in the United States
Humanitarian daily ration
Mess kit
Ninja diet
References
External links
History of food and drink
|
```smalltalk
using System;
using System.Linq;
using Microsoft.Xna.Framework.Input;
using StardewValley;
namespace StardewModdingAPI
{
/// <summary>A unified button constant which includes all controller, keyboard, and mouse buttons.</summary>
/// <remarks>Derived from <see cref="Keys"/>, <see cref="Buttons"/>, and <c>System.Windows.Forms.MouseButtons</c>.</remarks>
public enum SButton
{
/// <summary>No valid key.</summary>
None = 0,
/*********
** Mouse
*********/
/// <summary>The left mouse button.</summary>
MouseLeft = 1000,
/// <summary>The right mouse button.</summary>
MouseRight = 1001,
/// <summary>The middle mouse button.</summary>
MouseMiddle = 1002,
/// <summary>The first mouse XButton.</summary>
MouseX1 = 1003,
/// <summary>The second mouse XButton.</summary>
MouseX2 = 1004,
/*********
** Controller
*********/
/// <summary>The 'A' button on a controller.</summary>
ControllerA = SButtonExtensions.ControllerOffset + Buttons.A,
/// <summary>The 'B' button on a controller.</summary>
ControllerB = SButtonExtensions.ControllerOffset + Buttons.B,
/// <summary>The 'X' button on a controller.</summary>
ControllerX = SButtonExtensions.ControllerOffset + Buttons.X,
/// <summary>The 'Y' button on a controller.</summary>
ControllerY = SButtonExtensions.ControllerOffset + Buttons.Y,
/// <summary>The back button on a controller.</summary>
ControllerBack = SButtonExtensions.ControllerOffset + Buttons.Back,
/// <summary>The start button on a controller.</summary>
ControllerStart = SButtonExtensions.ControllerOffset + Buttons.Start,
/// <summary>The up button on the directional pad of a controller.</summary>
DPadUp = SButtonExtensions.ControllerOffset + Buttons.DPadUp,
/// <summary>The down button on the directional pad of a controller.</summary>
DPadDown = SButtonExtensions.ControllerOffset + Buttons.DPadDown,
/// <summary>The left button on the directional pad of a controller.</summary>
DPadLeft = SButtonExtensions.ControllerOffset + Buttons.DPadLeft,
/// <summary>The right button on the directional pad of a controller.</summary>
DPadRight = SButtonExtensions.ControllerOffset + Buttons.DPadRight,
/// <summary>The left bumper (shoulder) button on a controller.</summary>
LeftShoulder = SButtonExtensions.ControllerOffset + Buttons.LeftShoulder,
/// <summary>The right bumper (shoulder) button on a controller.</summary>
RightShoulder = SButtonExtensions.ControllerOffset + Buttons.RightShoulder,
/// <summary>The left trigger on a controller.</summary>
LeftTrigger = SButtonExtensions.ControllerOffset + Buttons.LeftTrigger,
/// <summary>The right trigger on a controller.</summary>
RightTrigger = SButtonExtensions.ControllerOffset + Buttons.RightTrigger,
/// <summary>The left analog stick on a controller (when pressed).</summary>
LeftStick = SButtonExtensions.ControllerOffset + Buttons.LeftStick,
/// <summary>The right analog stick on a controller (when pressed).</summary>
RightStick = SButtonExtensions.ControllerOffset + Buttons.RightStick,
/// <summary>The 'big button' on a controller.</summary>
BigButton = SButtonExtensions.ControllerOffset + Buttons.BigButton,
/// <summary>The left analog stick on a controller (when pushed left).</summary>
LeftThumbstickLeft = SButtonExtensions.ControllerOffset + Buttons.LeftThumbstickLeft,
/// <summary>The left analog stick on a controller (when pushed right).</summary>
LeftThumbstickRight = SButtonExtensions.ControllerOffset + Buttons.LeftThumbstickRight,
/// <summary>The left analog stick on a controller (when pushed down).</summary>
LeftThumbstickDown = SButtonExtensions.ControllerOffset + Buttons.LeftThumbstickDown,
/// <summary>The left analog stick on a controller (when pushed up).</summary>
LeftThumbstickUp = SButtonExtensions.ControllerOffset + Buttons.LeftThumbstickUp,
/// <summary>The right analog stick on a controller (when pushed left).</summary>
RightThumbstickLeft = SButtonExtensions.ControllerOffset + Buttons.RightThumbstickLeft,
/// <summary>The right analog stick on a controller (when pushed right).</summary>
RightThumbstickRight = SButtonExtensions.ControllerOffset + Buttons.RightThumbstickRight,
/// <summary>The right analog stick on a controller (when pushed down).</summary>
RightThumbstickDown = SButtonExtensions.ControllerOffset + Buttons.RightThumbstickDown,
/// <summary>The right analog stick on a controller (when pushed up).</summary>
RightThumbstickUp = SButtonExtensions.ControllerOffset + Buttons.RightThumbstickUp,
/*********
** Keyboard
*********/
/// <summary>The A button on a keyboard.</summary>
A = Keys.A,
/// <summary>The Add button on a keyboard.</summary>
Add = Keys.Add,
/// <summary>The Applications button on a keyboard.</summary>
Apps = Keys.Apps,
/// <summary>The Attn button on a keyboard.</summary>
Attn = Keys.Attn,
/// <summary>The B button on a keyboard.</summary>
B = Keys.B,
/// <summary>The Backspace button on a keyboard.</summary>
Back = Keys.Back,
/// <summary>The Browser Back button on a keyboard in Windows 2000/XP.</summary>
BrowserBack = Keys.BrowserBack,
/// <summary>The Browser Favorites button on a keyboard in Windows 2000/XP.</summary>
BrowserFavorites = Keys.BrowserFavorites,
/// <summary>The Browser Favorites button on a keyboard in Windows 2000/XP.</summary>
BrowserForward = Keys.BrowserForward,
/// <summary>The Browser Home button on a keyboard in Windows 2000/XP.</summary>
BrowserHome = Keys.BrowserHome,
/// <summary>The Browser Refresh button on a keyboard in Windows 2000/XP.</summary>
BrowserRefresh = Keys.BrowserRefresh,
/// <summary>The Browser Search button on a keyboard in Windows 2000/XP.</summary>
BrowserSearch = Keys.BrowserSearch,
/// <summary>The Browser Stop button on a keyboard in Windows 2000/XP.</summary>
BrowserStop = Keys.BrowserStop,
/// <summary>The C button on a keyboard.</summary>
C = Keys.C,
/// <summary>The Caps Lock button on a keyboard.</summary>
CapsLock = Keys.CapsLock,
/// <summary>The Green ChatPad button on a keyboard.</summary>
ChatPadGreen = Keys.ChatPadGreen,
/// <summary>The Orange ChatPad button on a keyboard.</summary>
ChatPadOrange = Keys.ChatPadOrange,
/// <summary>The CrSel button on a keyboard.</summary>
Crsel = Keys.Crsel,
/// <summary>The D button on a keyboard.</summary>
D = Keys.D,
/// <summary>A miscellaneous button on a keyboard; can vary by keyboard.</summary>
D0 = Keys.D0,
/// <summary>A miscellaneous button on a keyboard; can vary by keyboard.</summary>
D1 = Keys.D1,
/// <summary>A miscellaneous button on a keyboard; can vary by keyboard.</summary>
D2 = Keys.D2,
/// <summary>A miscellaneous button on a keyboard; can vary by keyboard.</summary>
D3 = Keys.D3,
/// <summary>A miscellaneous button on a keyboard; can vary by keyboard.</summary>
D4 = Keys.D4,
/// <summary>A miscellaneous button on a keyboard; can vary by keyboard.</summary>
D5 = Keys.D5,
/// <summary>A miscellaneous button on a keyboard; can vary by keyboard.</summary>
D6 = Keys.D6,
/// <summary>A miscellaneous button on a keyboard; can vary by keyboard.</summary>
D7 = Keys.D7,
/// <summary>A miscellaneous button on a keyboard; can vary by keyboard.</summary>
D8 = Keys.D8,
/// <summary>A miscellaneous button on a keyboard; can vary by keyboard.</summary>
D9 = Keys.D9,
/// <summary>The Decimal button on a keyboard.</summary>
Decimal = Keys.Decimal,
/// <summary>The Delete button on a keyboard.</summary>
Delete = Keys.Delete,
/// <summary>The Divide button on a keyboard.</summary>
Divide = Keys.Divide,
/// <summary>The Down arrow button on a keyboard.</summary>
Down = Keys.Down,
/// <summary>The E button on a keyboard.</summary>
E = Keys.E,
/// <summary>The End button on a keyboard.</summary>
End = Keys.End,
/// <summary>The Enter button on a keyboard.</summary>
Enter = Keys.Enter,
/// <summary>The Erase EOF button on a keyboard.</summary>
EraseEof = Keys.EraseEof,
/// <summary>The Escape button on a keyboard.</summary>
Escape = Keys.Escape,
/// <summary>The Execute button on a keyboard.</summary>
Execute = Keys.Execute,
/// <summary>The ExSel button on a keyboard.</summary>
Exsel = Keys.Exsel,
/// <summary>The F button on a keyboard.</summary>
F = Keys.F,
/// <summary>The F1 button on a keyboard.</summary>
F1 = Keys.F1,
/// <summary>The F10 button on a keyboard.</summary>
F10 = Keys.F10,
/// <summary>The F11 button on a keyboard.</summary>
F11 = Keys.F11,
/// <summary>The F12 button on a keyboard.</summary>
F12 = Keys.F12,
/// <summary>The F13 button on a keyboard.</summary>
F13 = Keys.F13,
/// <summary>The F14 button on a keyboard.</summary>
F14 = Keys.F14,
/// <summary>The F15 button on a keyboard.</summary>
F15 = Keys.F15,
/// <summary>The F16 button on a keyboard.</summary>
F16 = Keys.F16,
/// <summary>The F17 button on a keyboard.</summary>
F17 = Keys.F17,
/// <summary>The F18 button on a keyboard.</summary>
F18 = Keys.F18,
/// <summary>The F19 button on a keyboard.</summary>
F19 = Keys.F19,
/// <summary>The F2 button on a keyboard.</summary>
F2 = Keys.F2,
/// <summary>The F20 button on a keyboard.</summary>
F20 = Keys.F20,
/// <summary>The F21 button on a keyboard.</summary>
F21 = Keys.F21,
/// <summary>The F22 button on a keyboard.</summary>
F22 = Keys.F22,
/// <summary>The F23 button on a keyboard.</summary>
F23 = Keys.F23,
/// <summary>The F24 button on a keyboard.</summary>
F24 = Keys.F24,
/// <summary>The F3 button on a keyboard.</summary>
F3 = Keys.F3,
/// <summary>The F4 button on a keyboard.</summary>
F4 = Keys.F4,
/// <summary>The F5 button on a keyboard.</summary>
F5 = Keys.F5,
/// <summary>The F6 button on a keyboard.</summary>
F6 = Keys.F6,
/// <summary>The F7 button on a keyboard.</summary>
F7 = Keys.F7,
/// <summary>The F8 button on a keyboard.</summary>
F8 = Keys.F8,
/// <summary>The F9 button on a keyboard.</summary>
F9 = Keys.F9,
/// <summary>The G button on a keyboard.</summary>
G = Keys.G,
/// <summary>The H button on a keyboard.</summary>
H = Keys.H,
/// <summary>The Help button on a keyboard.</summary>
Help = Keys.Help,
/// <summary>The Home button on a keyboard.</summary>
Home = Keys.Home,
/// <summary>The I button on a keyboard.</summary>
I = Keys.I,
/// <summary>The IME Convert button on a keyboard.</summary>
ImeConvert = Keys.ImeConvert,
/// <summary>The IME NoConvert button on a keyboard.</summary>
ImeNoConvert = Keys.ImeNoConvert,
/// <summary>The INS button on a keyboard.</summary>
Insert = Keys.Insert,
/// <summary>The J button on a keyboard.</summary>
J = Keys.J,
/// <summary>The K button on a keyboard.</summary>
K = Keys.K,
/// <summary>The Kana button on a Japanese keyboard.</summary>
Kana = Keys.Kana,
/// <summary>The Kanji button on a Japanese keyboard.</summary>
Kanji = Keys.Kanji,
/// <summary>The L button on a keyboard.</summary>
L = Keys.L,
/// <summary>The Start Applications 1 button on a keyboard in Windows 2000/XP.</summary>
LaunchApplication1 = Keys.LaunchApplication1,
/// <summary>The Start Applications 2 button on a keyboard in Windows 2000/XP.</summary>
LaunchApplication2 = Keys.LaunchApplication2,
/// <summary>The Start Mail button on a keyboard in Windows 2000/XP.</summary>
LaunchMail = Keys.LaunchMail,
/// <summary>The Left arrow button on a keyboard.</summary>
Left = Keys.Left,
/// <summary>The Left Alt button on a keyboard.</summary>
LeftAlt = Keys.LeftAlt,
/// <summary>The Left Control button on a keyboard.</summary>
LeftControl = Keys.LeftControl,
/// <summary>The Left Shift button on a keyboard.</summary>
LeftShift = Keys.LeftShift,
/// <summary>The Left Windows button on a keyboard.</summary>
LeftWindows = Keys.LeftWindows,
/// <summary>The M button on a keyboard.</summary>
M = Keys.M,
/// <summary>The MediaNextTrack button on a keyboard in Windows 2000/XP.</summary>
MediaNextTrack = Keys.MediaNextTrack,
/// <summary>The MediaPlayPause button on a keyboard in Windows 2000/XP.</summary>
MediaPlayPause = Keys.MediaPlayPause,
/// <summary>The MediaPreviousTrack button on a keyboard in Windows 2000/XP.</summary>
MediaPreviousTrack = Keys.MediaPreviousTrack,
/// <summary>The MediaStop button on a keyboard in Windows 2000/XP.</summary>
MediaStop = Keys.MediaStop,
/// <summary>The Multiply button on a keyboard.</summary>
Multiply = Keys.Multiply,
/// <summary>The N button on a keyboard.</summary>
N = Keys.N,
/// <summary>The Num Lock button on a keyboard.</summary>
NumLock = Keys.NumLock,
/// <summary>The Numeric keypad 0 button on a keyboard.</summary>
NumPad0 = Keys.NumPad0,
/// <summary>The Numeric keypad 1 button on a keyboard.</summary>
NumPad1 = Keys.NumPad1,
/// <summary>The Numeric keypad 2 button on a keyboard.</summary>
NumPad2 = Keys.NumPad2,
/// <summary>The Numeric keypad 3 button on a keyboard.</summary>
NumPad3 = Keys.NumPad3,
/// <summary>The Numeric keypad 4 button on a keyboard.</summary>
NumPad4 = Keys.NumPad4,
/// <summary>The Numeric keypad 5 button on a keyboard.</summary>
NumPad5 = Keys.NumPad5,
/// <summary>The Numeric keypad 6 button on a keyboard.</summary>
NumPad6 = Keys.NumPad6,
/// <summary>The Numeric keypad 7 button on a keyboard.</summary>
NumPad7 = Keys.NumPad7,
/// <summary>The Numeric keypad 8 button on a keyboard.</summary>
NumPad8 = Keys.NumPad8,
/// <summary>The Numeric keypad 9 button on a keyboard.</summary>
NumPad9 = Keys.NumPad9,
/// <summary>The O button on a keyboard.</summary>
O = Keys.O,
/// <summary>A miscellaneous button on a keyboard; can vary by keyboard.</summary>
Oem8 = Keys.Oem8,
/// <summary>The OEM Auto button on a keyboard.</summary>
OemAuto = Keys.OemAuto,
/// <summary>The OEM Angle Bracket or Backslash button on the RT 102 keyboard in Windows 2000/XP.</summary>
OemBackslash = Keys.OemBackslash,
/// <summary>The Clear button on a keyboard.</summary>
OemClear = Keys.OemClear,
/// <summary>The OEM Close Bracket button on a US standard keyboard in Windows 2000/XP.</summary>
OemCloseBrackets = Keys.OemCloseBrackets,
/// <summary>The ',' button on a keyboard in any country/region in Windows 2000/XP.</summary>
OemComma = Keys.OemComma,
/// <summary>The OEM Copy button on a keyboard.</summary>
OemCopy = Keys.OemCopy,
/// <summary>The OEM Enlarge Window button on a keyboard.</summary>
OemEnlW = Keys.OemEnlW,
/// <summary>The '-' button on a keyboard in any country/region in Windows 2000/XP.</summary>
OemMinus = Keys.OemMinus,
/// <summary>The OEM Open Bracket button on a US standard keyboard in Windows 2000/XP.</summary>
OemOpenBrackets = Keys.OemOpenBrackets,
/// <summary>The '.' button on a keyboard in any country/region.</summary>
OemPeriod = Keys.OemPeriod,
/// <summary>The OEM Pipe button on a US standard keyboard.</summary>
OemPipe = Keys.OemPipe,
/// <summary>The '+' button on a keyboard in Windows 2000/XP.</summary>
OemPlus = Keys.OemPlus,
/// <summary>The OEM Question Mark button on a US standard keyboard.</summary>
OemQuestion = Keys.OemQuestion,
/// <summary>The OEM Single/Double Quote button on a US standard keyboard.</summary>
OemQuotes = Keys.OemQuotes,
/// <summary>The OEM Semicolon button on a US standard keyboard.</summary>
OemSemicolon = Keys.OemSemicolon,
/// <summary>The OEM Tilde button on a US standard keyboard.</summary>
OemTilde = Keys.OemTilde,
/// <summary>The P button on a keyboard.</summary>
P = Keys.P,
/// <summary>The PA1 button on a keyboard.</summary>
Pa1 = Keys.Pa1,
/// <summary>The Page Down button on a keyboard.</summary>
PageDown = Keys.PageDown,
/// <summary>The Page Up button on a keyboard.</summary>
PageUp = Keys.PageUp,
/// <summary>The Pause button on a keyboard.</summary>
Pause = Keys.Pause,
/// <summary>The Play button on a keyboard.</summary>
Play = Keys.Play,
/// <summary>The Print button on a keyboard.</summary>
Print = Keys.Print,
/// <summary>The Print Screen button on a keyboard.</summary>
PrintScreen = Keys.PrintScreen,
/// <summary>The IME Process button on a keyboard in Windows 95/98/ME/NT 4.0/2000/XP.</summary>
ProcessKey = Keys.ProcessKey,
/// <summary>The Q button on a keyboard.</summary>
Q = Keys.Q,
/// <summary>The R button on a keyboard.</summary>
R = Keys.R,
/// <summary>The Right Arrow button on a keyboard.</summary>
Right = Keys.Right,
/// <summary>The Right Alt button on a keyboard.</summary>
RightAlt = Keys.RightAlt,
/// <summary>The Right Control button on a keyboard.</summary>
RightControl = Keys.RightControl,
/// <summary>The Right Shift button on a keyboard.</summary>
RightShift = Keys.RightShift,
/// <summary>The Right Windows button on a keyboard.</summary>
RightWindows = Keys.RightWindows,
/// <summary>The S button on a keyboard.</summary>
S = Keys.S,
/// <summary>The Scroll Lock button on a keyboard.</summary>
Scroll = Keys.Scroll,
/// <summary>The Select button on a keyboard.</summary>
Select = Keys.Select,
/// <summary>The Select Media button on a keyboard in Windows 2000/XP.</summary>
SelectMedia = Keys.SelectMedia,
/// <summary>The Separator button on a keyboard.</summary>
Separator = Keys.Separator,
/// <summary>The Computer Sleep button on a keyboard.</summary>
Sleep = Keys.Sleep,
/// <summary>The Space bar on a keyboard.</summary>
Space = Keys.Space,
/// <summary>The Subtract button on a keyboard.</summary>
Subtract = Keys.Subtract,
/// <summary>The T button on a keyboard.</summary>
T = Keys.T,
/// <summary>The Tab button on a keyboard.</summary>
Tab = Keys.Tab,
/// <summary>The U button on a keyboard.</summary>
U = Keys.U,
/// <summary>The Up Arrow button on a keyboard.</summary>
Up = Keys.Up,
/// <summary>The V button on a keyboard.</summary>
V = Keys.V,
/// <summary>The Volume Down button on a keyboard in Windows 2000/XP.</summary>
VolumeDown = Keys.VolumeDown,
/// <summary>The Volume Mute button on a keyboard in Windows 2000/XP.</summary>
VolumeMute = Keys.VolumeMute,
/// <summary>The Volume Up button on a keyboard in Windows 2000/XP.</summary>
VolumeUp = Keys.VolumeUp,
/// <summary>The W button on a keyboard.</summary>
W = Keys.W,
/// <summary>The X button on a keyboard.</summary>
X = Keys.X,
/// <summary>The Y button on a keyboard.</summary>
Y = Keys.Y,
/// <summary>The Z button on a keyboard.</summary>
Z = Keys.Z,
/// <summary>The Zoom button on a keyboard.</summary>
Zoom = Keys.Zoom
}
/// <summary>Provides extension methods for <see cref="SButton"/>.</summary>
public static class SButtonExtensions
{
/*********
** Accessors
*********/
/// <summary>The offset added to <see cref="Buttons"/> values when converting them to <see cref="SButton"/> to avoid collisions with <see cref="Keys"/> values.</summary>
internal const int ControllerOffset = 2000;
/*********
** Public methods
*********/
/// <summary>Get the <see cref="SButton"/> equivalent for the given button.</summary>
/// <param name="key">The keyboard button to convert.</param>
public static SButton ToSButton(this Keys key)
{
return (SButton)key;
}
/// <summary>Get the <see cref="SButton"/> equivalent for the given button.</summary>
/// <param name="key">The controller button to convert.</param>
public static SButton ToSButton(this Buttons key)
{
return (SButton)(SButtonExtensions.ControllerOffset + key);
}
/// <summary>Get the <see cref="SButton"/> equivalent for the given button.</summary>
/// <param name="input">The Stardew Valley button to convert.</param>
public static SButton ToSButton(this InputButton input)
{
// derived from InputButton constructors
if (input.mouseLeft)
return SButton.MouseLeft;
if (input.mouseRight)
return SButton.MouseRight;
return input.key.ToSButton();
}
/// <summary>Get the <see cref="Keys"/> equivalent for the given button.</summary>
/// <param name="input">The button to convert.</param>
/// <param name="key">The keyboard equivalent.</param>
/// <returns>Returns whether the value was converted successfully.</returns>
public static bool TryGetKeyboard(this SButton input, out Keys key)
{
if (Enum.IsDefined(typeof(Keys), (int)input))
{
key = (Keys)input;
return true;
}
key = Keys.None;
return false;
}
/// <summary>Get the <see cref="Buttons"/> equivalent for the given button.</summary>
/// <param name="input">The button to convert.</param>
/// <param name="button">The controller equivalent.</param>
/// <returns>Returns whether the value was converted successfully.</returns>
public static bool TryGetController(this SButton input, out Buttons button)
{
if (Enum.IsDefined(typeof(Buttons), (int)input - SButtonExtensions.ControllerOffset))
{
button = (Buttons)(input - SButtonExtensions.ControllerOffset);
return true;
}
button = 0;
return false;
}
/// <summary>Get the <see cref="InputButton"/> equivalent for the given button.</summary>
/// <param name="input">The button to convert.</param>
/// <param name="button">The Stardew Valley input button equivalent.</param>
/// <returns>Returns whether the value was converted successfully.</returns>
public static bool TryGetStardewInput(this SButton input, out InputButton button)
{
// keyboard
if (input.TryGetKeyboard(out Keys key))
{
button = new InputButton(key);
return true;
}
// mouse
if (input is SButton.MouseLeft or SButton.MouseRight)
{
button = new InputButton(mouseLeft: input == SButton.MouseLeft);
return true;
}
// not valid
button = default;
return false;
}
/// <summary>Get whether the given button is equivalent to <see cref="Options.useToolButton"/>.</summary>
/// <param name="input">The button.</param>
public static bool IsUseToolButton(this SButton input)
{
return input == SButton.ControllerX || Game1.options.useToolButton.Any(p => p.ToSButton() == input);
}
/// <summary>Get whether the given button is equivalent to <see cref="Options.actionButton"/>.</summary>
/// <param name="input">The button.</param>
public static bool IsActionButton(this SButton input)
{
return input == SButton.ControllerA || Game1.options.actionButton.Any(p => p.ToSButton() == input);
}
}
}
```
|
```less
// Flat UI main stylesheet that aggregates all modules
// Loading custom fonts
//@import url("path_to_url");
@import "modules/local-fonts";
@import "modules/glyphicons";
// Loading config with variables (changing them leads to changing a color scheme)
@import "variables";
// Utility mixins for greater good
@import "mixins";
@import "modules/scaffolding";
// Modules
@import "modules/type";
@import "modules/code";
@import "modules/thumbnails";
@import "modules/buttons";
@import "modules/button-groups";
@import "modules/caret";
@import "modules/select";
@import "modules/forms";
@import "modules/input-icons";
@import "modules/input-groups";
@import "modules/checkbox-and-radio";
@import "modules/navbar";
@import "modules/tagsinput";
@import "modules/typeahead";
@import "modules/progress-bars";
@import "modules/slider";
@import "modules/pager";
@import "modules/pagination";
@import "modules/tooltip";
@import "modules/dropdown";
@import "modules/switch";
@import "modules/share";
// Examples
@import "modules/palette";
@import "modules/tile";
@import "modules/todo";
@import "modules/video";
@import "modules/login";
@import "modules/footer";
// Spaces
@import "spaces";
```
|
```java
package org.telegram.telegrambots.meta.api.methods.groupadministration;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import lombok.experimental.Tolerate;
import lombok.extern.jackson.Jacksonized;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ChatInviteLink;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/**
* @author Ruben Bermudez
* @version 5.1
*
* Use this method to create an additional invite link for a chat.
* The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
*
* The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@AllArgsConstructor
@RequiredArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class CreateChatInviteLink extends BotApiMethod<ChatInviteLink> {
public static final String PATH = "createChatInviteLink";
private static final String CHATID_FIELD = "chat_id";
private static final String EXPIREDATE_FIELD = "expire_date";
private static final String MEMBERLIMIT_FIELD = "member_limit";
private static final String NAME_FIELD = "name";
private static final String CREATESJOINREQUEST_FIELD = "creates_join_request";
@JsonProperty(CHATID_FIELD)
@NonNull
private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername)
@JsonProperty(EXPIREDATE_FIELD)
private Integer expireDate; ///< Optional. Point in time (Unix timestamp) when the link will expire
/**
* Optional.
* Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
*/
@JsonProperty(MEMBERLIMIT_FIELD)
private Integer memberLimit; ///< Optional. Invite link name; 0-32 characters
@JsonProperty(NAME_FIELD)
private String name; ///< Optional. Invite link name; 0-32 characters
/**
* Optional.
* True, if users joining the chat via the link need to be approved by chat administrators.
* If True, member_limit can't be specified
*/
@JsonProperty(CREATESJOINREQUEST_FIELD)
private Boolean createsJoinRequest;
@Tolerate
public void setChatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
}
@Override
public String getMethod() {
return PATH;
}
@Override
public ChatInviteLink deserializeResponse(String answer) throws TelegramApiRequestException {
return deserializeResponse(answer, ChatInviteLink.class);
}
@Override
public void validate() throws TelegramApiValidationException {
if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
if (name != null && name.length() > 32) {
throw new TelegramApiValidationException("Name must be between 0 and 32 characters", this);
}
if (createsJoinRequest != null && memberLimit != null) {
throw new TelegramApiValidationException("MemberLimit can not be used with CreatesJoinRequest field", this);
}
if (memberLimit != null && (memberLimit < 1 || memberLimit > 99999)) {
throw new TelegramApiValidationException("MemberLimit must be between 1 and 99999", this);
}
}
public static abstract class CreateChatInviteLinkBuilder<C extends CreateChatInviteLink, B extends CreateChatInviteLinkBuilder<C, B>> extends BotApiMethodBuilder<ChatInviteLink, C, B> {
@Tolerate
public CreateChatInviteLinkBuilder<C, B> chatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
return this;
}
}
}
```
|
Stephen Chibuikem Chukwumah (born 17 September 1988) is a Nigerian born Advocate and Strategist with extensive background in Youth Leadership and Advocacy, Policy, Movement Building, and Fund Raising. He is a public speaker and a former fellow of the faculty of Law, University of York, England. Stephen Chukwumah had a five year career as a Lead Division Coordinator at the International Monetary Fund in Washington, D.C., and is currently a Policy Advocate at the Council for Global Equality. He is from Ebenebe in Awka North LGA, Anambra state, Nigeria.
Education
Stephen has a masters degree in Global Policy from Johns Hopkins University and a certificate in Organisational Leadership from Harvard. He started his primary education at Duro-Oyedoyin primary school surulere Lagos and finished as one of the best pupil, he attended Iponri Estate High School in surulere Lagos for his secondary education. During his time in high school, Stephen and a select few were chosen by their teachers to represent their school at the National Youth AIDS program for peer-educators organised by the Lagos state government and National Union of Teachers Lagos state chapter. Stephen was offered admission to read mass-communication at Nnamdi Azikiwe University in Awka Anambra state but he proceeded to the prestigious Ambrose Alli University Ekpoma, Edo state, to read English and Literary studies. During his first year at the university, he was voted his class representative after a keenly contested election and he occupied the position till graduation due to his impeccable leadership skills and for constantly advocating for the rights of students in the university. After his undergraduate degree, Stephen proceeded to the University of York in England as visiting fellow in the faculty of law.
Career
Stephen worked as a peer-educator in his early days in high school and was trained by the Lagos State Government through the National Youth AIDS program and also through the National Union of Teachers' HIV/AIDS program Lagos chapter. He started at a very young age, his advocacy and voluntary work with NGO's in Nigeria, working with Most at Risk Populations(MARPS), serving as a youth board member for one of Nigeria's NGO working on sexual health. Stephen started his international work with the Youth Coalition on sexual and reproductive rights in Canada, he served as an International Youth Advisor to the United Nations Fund Population Agency and as an International Advisor to Rutgers Nisso Group through their Youth Incentives program in the Netherlands. He worked as a steering committee member for the HIV Young Leaders Fund, served as a youth activist for Advocates for Youth in Washington, D.C., United States. He is the founder and Executive Director of Improved Youth Health Initiative, working on sexual health and rights for and with young people in Eastern Nigeria. He has a diploma from the RFSU International Training program on Sexual Health and Human Rights in Stockholm Sweden and Cape Town South Africa sponsored by the Swedish government.
In May 2013, Stephen Chukwumah with three other representatives from civil society organisations met with the Swedish minister for International Development Cooperation Ms. Gunilla Carlsson to discuss development issues affecting young people in Nigeria and suggest possible ways of co-operation between Sweden and Nigeria. In December of the same year, Stephen Chukwumah wrote an open letter to the Senate President of Nigeria, condemning the governments move to criminalise sexual minorities. In his open letter, he highlighted the ugly impact their actions would have on Nigeria's effort to curb HIV/AIDS. The widely read letter was published on different media platforms with excerpts from the letter appearing in an article in the renowned UK magazine The Economist.
In 2013, Stephen became the youngest at the time to be awarded a scholarship to do a fellowship at the Faculty of Law University of York in England. During his time in England, he was invited to a breakfast with the Mayor of York to discuss his work and general human rights issues in Nigeria and the African region.
Stephen is also regarded as a refreshing public speaker and has spoken to young girls at the Mount school in York United Kingdom. He was one of the speakers at the Langwith College International Action Week and gave a very well received public talk on sexual rights to professors and students of the faculty of law University of York England.
Stephen speaks at international conferences, workshops, trainings and has spoken at the highly acclaimed University of Maryland, USA. He facilitates sessions and workshops at international and local trainings including a session at the 2012 International AIDS conference youth pre-conference. Stephen travels the world working on human rights and sexual health issues and he writes on topics that he is passionate about. He writes about social issues in Nigeria through articles on Jungle Justice, Gender Equality. and an Open Letter to Governor Abiola Ajimobi of Oyo state in south-western Nigeria.
In November 2016, Stephen Chukwumah was selected as DyNAMC Magazine's Leader for a Changing World and was featured on the front page of their November issue.
Acting and dancing
Stephen started acting as a hobby at a young age at home and in church and would then proceed to becoming very popular in secondary school for participating in drama presentations. As a teenager, he started dancing professionally with a dance group in Lagos and they performed at different events and cities in Nigeria. Stephen through his work with Youth Abalaze in Nigeria was featured in a campus soap-opera "Evanessence" but has since been unreleased.
Human rights activism
Stephen Chukwumah is an internationally recognised human rights activist. His involvement with human rights work started in school with advocating for the rights of students which led him into hiding in a remote village in Edo state Nigeria for two weeks after participating in a student protest and challenging the state government on television for increasing school fees. In 2007 he started a youth organisation that provides sexual health and human rights information and services to young sexual minorities. Stephen through his organisation Improved Youth Health Initiative, continues to provide human rights and HIV/AIDS information and services to young minorities with funding and technical support from MTV Staying Alive Foundation and Advocates for Youth.
References
External links
http://zimuzo.com/2013/01/11/stephen-chukwumah/
http://youthcoalition.org/html/alumni.php?alumni=1
http://www.hivyoungleadersfund.org/about-us/team/
https://www.law.upenn.edu/journals/jlasc/articles/volume15/issue2/Kossen15U.Pa.J.L.&Soc.Change(2012)143.pdf
http://www.bayelsabookfair.com/stephen-chukwumah/
http://www.conversationsforabetterworld.com/2011/06/get-involved
http://www.iyhinitiative.org/
http://telegraphng.com/2013/10/campaign-sexual-health-rights-issues-2/
Nigerian activists
Living people
1988 births
|
```xml
<vector xmlns:android="path_to_url"
android:width="256dp"
android:height="256dp"
android:viewportWidth="256"
android:viewportHeight="256">
<path
android:pathData="M0,0h208v256h-208z"
android:fillColor="#808080"/>
<path
android:pathData="m144,16v32h8v-32zM144,80v32h8v-32zM144,144v32h8v-32zM144,208v32h8v-32z"
android:fillColor="#fff"/>
<path
android:pathData="m175.71,168.04a7.21,7.18 0,0 1,-7.21 7.18,7.21 7.18,0 0,1 -7.21,-7.18 7.21,7.18 0,0 1,7.21 -7.18,7.21 7.18,0 0,1 7.21,7.18zM199.22,168.04a7.21,7.18 0,0 1,-7.21 7.18,7.21 7.18,0 0,1 -7.21,-7.18 7.21,7.18 0,0 1,7.21 -7.18,7.21 7.18,0 0,1 7.21,7.18zM172.51,156.98 L181.62,168h10.42l-7.16,-11.02h-12.37m-3.91,11.02 l5.43,-16.09h5.21m5.64,2.47 l3.17,-0.01m-6.43,13.62 l3.26,-13.61"
android:strokeLineJoin="round"
android:strokeWidth="3"
android:strokeColor="#fff"
android:strokeLineCap="round"/>
<path
android:pathData="m192,128 l-12,-16 -12,16h8v8h8v-8z"
android:fillColor="#fff"/>
</vector>
```
|
Lesce () is a town in the Municipality of Radovljica in the Upper Carniola region of Slovenia. It is an industrial and tourist centre.
It is one of the earliest-mentioned settlements in the region, first noted in a document from 1004 together with Bled and Bohinj.
Lesce is the location of the Lesce–Bled Airfield and Šobec Campground. Lesce is also the home town of retired ski jumpers Vinko Bogataj and Franci Petek. Lesce was selected by MTV as the site for its annual Spring Break Jam in the spring of 2009.
Church
In the centre of the old town there is a three-aisled pilgrimage church dedicated to the Assumption of the Virgin, originally a Gothic church with remnants of 14th-century frescos on its exterior, but which was extensively changed in the 17th century in the Baroque style. The church is known for its frescoes in the dome of the chancel painted by Franc Jelovšek.
Sports
NK Lesce football club has a long tradition of competing at the regional level (since 1946). Na Žagi Stadium () is a multi-purpose stadium in Lesce. It is used for football matches and is the home ground of NK Lesce. The stadium currently holds 800 spectators, 45 of them can be seated.
References
External links
Lesce on Geopedia
Populated places in the Municipality of Radovljica
|
The House of the Army of the Republic of North Macedonia (), before known as the House of the Yugoslav People's Army () is an elite object in the city of Strumica, North Macedonia used for various events, some of them being cultural manifestations, ceremonies and sessions of the municipality. It is located in the Central Park, on Blagoj Jankov Mučeto street. After the independence of Macedonia in 1991 it was in ownership of ARM, but after the closing of the military barracks in 2005 it was given to the local municipality.
Buildings and structures in Strumica
|
```c++
#include <cstdio>
#define NIL 0
using namespace std;
struct node
{
int key, value;
node *ch[2];
node(int _key = 0, int _value = 0) : key(_key), value(_value) { ch[0] = ch[1] = NIL; }
}*root;
void rotate(node *&u, int dir)
{
node *o = u->ch[dir];
u->ch[dir] = o->ch[dir ^ 1];
o->ch[dir ^ 1] = u;
u = o;
}
void insert(node *&u, int key, int value)
{
if (u == NIL)
{
u = new node(key, value);
return;
}
if (key < u->key)
{
insert(u->ch[0], key, value);
rotate(u, 0);
}
else if (key > u->key)
{
insert(u->ch[1], key, value);
rotate(u, 1);
}
}
int find(node *&u, int key)
{
if (u == NIL)
{
return -1;
}
if (u->key == key)
{
return u->value;
}
int res;
if (key < u->key)
{
res = find(u->ch[0], key);
if (u->ch[0] != NIL)
rotate(u, 0);
}
else if (key > u->key)
{
res = find(u->ch[1], key);
if (u->ch[1] != NIL)
rotate(u, 1);
}
return res;
}
int main()
{
int in, key, value;
while (true)
{
scanf("%d", &in);
if (in == 1)
{
scanf("%d%d", &key, &value);
insert(root, key, value);
}
else if (in == 2)
{
scanf("%d", &key);
printf("%d\n", find(root, key));
}
else if (in == 0)
{
return 0;
}
else
{
printf("No such command!\n");
}
}
return 0;
}
```
|
```javascript
import * as macro from 'vtk.js/Sources/macros';
import vtkWebGPUBufferManager from 'vtk.js/Sources/Rendering/WebGPU/BufferManager';
import vtkWebGPUCellArrayMapper from 'vtk.js/Sources/Rendering/WebGPU/CellArrayMapper';
import vtkViewNode from 'vtk.js/Sources/Rendering/SceneGraph/ViewNode';
import { registerOverride } from 'vtk.js/Sources/Rendering/WebGPU/ViewNodeFactory';
const { PrimitiveTypes } = vtkWebGPUBufferManager;
// your_sha256_hash------------
// vtkWebGPUPolyDataMapper methods
// your_sha256_hash------------
function vtkWebGPUPolyDataMapper(publicAPI, model) {
// Set our className
model.classHierarchy.push('vtkWebGPUPolyDataMapper');
publicAPI.createCellArrayMapper = () =>
vtkWebGPUCellArrayMapper.newInstance();
publicAPI.buildPass = (prepass) => {
if (prepass) {
model.WebGPUActor = publicAPI.getFirstAncestorOfType('vtkWebGPUActor');
if (!model.renderable.getStatic()) {
model.renderable.update();
}
const poly = model.renderable.getInputData();
model.renderable.mapScalars(poly, 1.0);
publicAPI.updateCellArrayMappers(poly);
}
};
publicAPI.updateCellArrayMappers = (poly) => {
const prims = [
poly.getVerts(),
poly.getLines(),
poly.getPolys(),
poly.getStrips(),
];
// we instantiate a cell array mapper for each cellArray that has cells
// and they handle the rendering of that cell array
const cellMappers = [];
let cellOffset = 0;
for (let i = PrimitiveTypes.Points; i <= PrimitiveTypes.Triangles; i++) {
if (prims[i].getNumberOfValues() > 0) {
if (!model.primitives[i]) {
model.primitives[i] = publicAPI.createCellArrayMapper();
}
const cellMapper = model.primitives[i];
cellMapper.setCellArray(prims[i]);
cellMapper.setCurrentInput(poly);
cellMapper.setCellOffset(cellOffset);
cellMapper.setPrimitiveType(i);
cellMapper.setRenderable(model.renderable);
cellOffset += prims[i].getNumberOfCells();
cellMappers.push(cellMapper);
} else {
model.primitives[i] = null;
}
}
if (model.WebGPUActor.getRenderable().getProperty().getEdgeVisibility()) {
for (
let i = PrimitiveTypes.TriangleEdges;
i <= PrimitiveTypes.TriangleStripEdges;
i++
) {
if (prims[i - 2].getNumberOfValues() > 0) {
if (!model.primitives[i]) {
model.primitives[i] = publicAPI.createCellArrayMapper();
}
const cellMapper = model.primitives[i];
cellMapper.setCellArray(prims[i - 2]);
cellMapper.setCurrentInput(poly);
cellMapper.setCellOffset(model.primitives[i - 2].getCellOffset());
cellMapper.setPrimitiveType(i);
cellMapper.setRenderable(model.renderable);
cellMappers.push(cellMapper);
} else {
model.primitives[i] = null;
}
}
}
publicAPI.prepareNodes();
publicAPI.addMissingChildren(cellMappers);
publicAPI.removeUnusedNodes();
};
}
// your_sha256_hash------------
// Object factory
// your_sha256_hash------------
const DEFAULT_VALUES = {
primitives: null,
};
// your_sha256_hash------------
export function extend(publicAPI, model, initialValues = {}) {
Object.assign(model, DEFAULT_VALUES, initialValues);
// Inheritance
vtkViewNode.extend(publicAPI, model, initialValues);
model.primitives = [];
// Object methods
vtkWebGPUPolyDataMapper(publicAPI, model);
}
// your_sha256_hash------------
export const newInstance = macro.newInstance(extend, 'vtkWebGPUPolyDataMapper');
// your_sha256_hash------------
export default { newInstance, extend };
// Register ourself to WebGPU backend if imported
registerOverride('vtkMapper', newInstance);
```
|
Mirza Mehdy Ispahani (also known as Sadri Ispahani; 1923–2004), son of Mirza Ahmad Ispahani, was Chairman of M.M. Ispahani from 1949 until 2004. Mirza Ali Behrouze Ispahani, son of Mirza Mehdy Ispahani was elected as the Chairman of M.M. Ispahani in 2004.
Business policy
In 1947, M.M. Ispahani moved its corporate headquarters in Chittagong with Mirza Ahmed's son Mirza Mehdy Ispahani at the helm of the businesses. After partition, the group made significant investments into tea-plantations in Sylhet. During this period the group was also the largest jute exporter in the Indian Sub-continent.
Career
Sadri was made chairman of the Ispahani Group at the age of 26. He continued to support different charitable institutions and organizations engaged in social welfare activities. In 1987, after the death of his father, Sadri founded a school in Pahartali, Chittagong named Mirza Ahmed Ispahani High School.
Mirza Mehdy Ispahani also played a political role in Bangladesh. He was the founder treasure of National Awami Party in 1957.
Death
He died on 20 January 2004 in Bumrungrad Hospital, Bangkok from cardiac arrest, leaving behind his wife, five sons, three daughters.
See also
Yar Mohammad Khan
Ispahani family
References
Mirza Mehdy
20th-century Bangladeshi businesspeople
People from Chittagong
1923 births
2004 deaths
National Awami Party politicians
Bangladeshi chairpersons of corporations
Bangladeshi Shia Muslims
|
```xml
declare const _default: any;
export default _default;
//# sourceMappingURL=ExponentDeviceMotion.d.ts.map
```
|
```javascript
// Generated by CoffeeScript 1.12.7
(function() {
var NodeType, XMLCharacterData, XMLText,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
NodeType = require('./NodeType');
XMLCharacterData = require('./XMLCharacterData');
module.exports = XMLText = (function(superClass) {
extend(XMLText, superClass);
function XMLText(parent, text) {
XMLText.__super__.constructor.call(this, parent);
if (text == null) {
throw new Error("Missing element text. " + this.debugInfo());
}
this.name = "#text";
this.type = NodeType.Text;
this.value = this.stringify.text(text);
}
Object.defineProperty(XMLText.prototype, 'isElementContentWhitespace', {
get: function() {
throw new Error("This DOM method is not implemented." + this.debugInfo());
}
});
Object.defineProperty(XMLText.prototype, 'wholeText', {
get: function() {
var next, prev, str;
str = '';
prev = this.previousSibling;
while (prev) {
str = prev.data + str;
prev = prev.previousSibling;
}
str += this.data;
next = this.nextSibling;
while (next) {
str = str + next.data;
next = next.nextSibling;
}
return str;
}
});
XMLText.prototype.clone = function() {
return Object.create(this);
};
XMLText.prototype.toString = function(options) {
return this.options.writer.text(this, this.options.writer.filterOptions(options));
};
XMLText.prototype.splitText = function(offset) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
XMLText.prototype.replaceWholeText = function(content) {
throw new Error("This DOM method is not implemented." + this.debugInfo());
};
return XMLText;
})(XMLCharacterData);
}).call(this);
```
|
```objective-c
//
//
// path_to_url
//
// Unless required by applicable law or agreed to in writing, software
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#pragma once
#include <vector>
#include "paddle/phi/core/dense_tensor.h"
namespace phi {
template <typename T, typename Context>
void UniqueConsecutiveKernel(const Context& dev_ctx,
const DenseTensor& x,
bool return_inverse,
bool return_counts,
const std::vector<int>& axis,
DataType dtype,
DenseTensor* out,
DenseTensor* index,
DenseTensor* counts);
} // namespace phi
```
|
```kotlin
package mega.privacy.android.shared.sync
import androidx.annotation.StringRes
import mega.privacy.android.domain.entity.sync.SyncError
import mega.privacy.android.shared.resources.R
import javax.inject.Inject
/**
* UI Mapper that retrieves the appropriate Device Folder Error Message from a Device Folder's
* [SyncError]
*/
class DeviceFolderUINodeErrorMessageMapper @Inject constructor() {
/**
* Invocation function
*
* @param errorSubState The corresponding [SyncError]
* @return A [StringRes] of the specific Error Message
*/
operator fun invoke(errorSubState: SyncError?): Int? = when (errorSubState) {
SyncError.NO_SYNC_ERROR -> null
SyncError.UNKNOWN_ERROR -> R.string.general_sync_message_unknown_error
SyncError.UNSUPPORTED_FILE_SYSTEM -> R.string.general_sync_unsupported_file_system
SyncError.INVALID_REMOTE_TYPE -> R.string.general_sync_invalid_remote_type
SyncError.INVALID_LOCAL_TYPE -> R.string.general_sync_invalid_local_type
SyncError.INITIAL_SCAN_FAILED -> R.string.general_sync_initial_scan_failed
SyncError.LOCAL_PATH_TEMPORARY_UNAVAILABLE -> R.string.general_sync_message_cannot_locate_local_drive_now
SyncError.LOCAL_PATH_UNAVAILABLE -> R.string.general_sync_message_cannot_locate_local_drive
SyncError.REMOTE_NODE_NOT_FOUND -> R.string.general_sync_remote_node_not_found
SyncError.STORAGE_OVERQUOTA -> R.string.general_sync_storage_overquota
SyncError.ACCOUNT_EXPIRED -> R.string.general_sync_account_expired
SyncError.FOREIGN_TARGET_OVERSTORAGE -> R.string.general_sync_foreign_target_overshare
SyncError.REMOTE_PATH_HAS_CHANGED -> R.string.general_sync_remote_path_has_changed
SyncError.SHARE_NON_FULL_ACCESS -> R.string.general_sync_share_non_full_access
SyncError.LOCAL_FILESYSTEM_MISMATCH -> R.string.general_sync_local_filesystem_mismatch
SyncError.PUT_NODES_ERROR -> R.string.general_sync_put_nodes_error
SyncError.ACTIVE_SYNC_BELOW_PATH -> R.string.general_sync_active_sync_below_path
SyncError.VBOXSHAREDFOLDER_UNSUPPORTED -> R.string.general_sync_vboxsharedfolder_unsupported
SyncError.ACCOUNT_BLOCKED -> R.string.general_sync_account_blocked
SyncError.UNKNOWN_TEMPORARY_ERROR -> R.string.general_sync_unknown_temporary_error
SyncError.TOO_MANY_ACTION_PACKETS -> R.string.general_sync_too_many_action_packets
SyncError.LOGGED_OUT -> R.string.general_sync_logged_out
SyncError.BACKUP_MODIFIED -> R.string.general_sync_message_folder_backup_issue_due_to_recent_changes
SyncError.BACKUP_SOURCE_NOT_BELOW_DRIVE -> R.string.general_sync_backup_source_not_below_drive
SyncError.SYNC_CONFIG_WRITE_FAILURE -> R.string.general_sync_message_folder_backup_issue
SyncError.ACTIVE_SYNC_SAME_PATH -> R.string.general_sync_active_sync_same_path
SyncError.COULD_NOT_MOVE_CLOUD_NODES -> R.string.general_sync_could_not_move_cloud_nodes
SyncError.COULD_NOT_CREATE_IGNORE_FILE -> R.string.general_sync_could_not_create_ignore_file
SyncError.SYNC_CONFIG_READ_FAILURE -> R.string.general_sync_config_read_failure
SyncError.UNKNOWN_DRIVE_PATH -> R.string.general_sync_unknown_drive_path
SyncError.INVALID_SCAN_INTERVAL -> R.string.general_sync_invalid_scan_interval
SyncError.NOTIFICATION_SYSTEM_UNAVAILABLE -> R.string.general_sync_notification_system_unavailable
SyncError.UNABLE_TO_ADD_WATCH -> R.string.general_sync_unable_to_add_watch
SyncError.INSUFFICIENT_DISK_SPACE -> R.string.general_sync_insufficient_disk_space
SyncError.UNABLE_TO_RETRIEVE_ROOT_FSID,
SyncError.FAILURE_ACCESSING_PERSISTENT_STORAGE,
-> R.string.general_sync_unable_to_retrieve_root_fsid
SyncError.UNABLE_TO_OPEN_DATABASE,
SyncError.MISMATCH_OF_ROOT_FSID,
SyncError.FILESYSTEM_FILE_IDS_ARE_UNSTABLE,
SyncError.FILESYSTEM_ID_UNAVAILABLE,
-> R.string.general_sync_message_folder_backup_issue
SyncError.REMOTE_NODE_MOVED_TO_RUBBISH,
SyncError.REMOTE_NODE_INSIDE_RUBBISH,
-> R.string.general_sync_message_node_in_rubbish_bin
SyncError.ACTIVE_SYNC_ABOVE_PATH,
SyncError.LOCAL_PATH_SYNC_COLLISION,
-> R.string.your_sha256_hashther_backed_up_folder
else -> R.string.general_sync_message_unknown_error
}
}
```
|
The Knowledge Master Open (commonly known as Knowledge Masters or KMO) was a computer-based semiannual worldwide academic competition produced by Academic Hallmarks. During KMO competitions, teams of students from many schools earned points by answering multiple-choice questions quickly and accurately. The questions included fifteen subject areas: American history, world history, government, recent events, economics & law, geography, literature, English, math, physical science, biology, earth science, health & psychology, fine arts, and useless trivia.
The competition started in 1983 with 74 schools. In 2009, there were about 45,000 participants from over 3,000 high schools and middle schools in the U.S. and other countries. The last contest occurred in April 2013. Over the 30 years of KMO competition, more than 2.4 million students participated.
There were five levels of competition. Fifth and sixth grade contests were held in January and March and consisted of 100 questions. Middle school (up to grade 8), junior high (up to grade 9), and high school (up to grade 12) contests were held in December and April and consisted of 200 questions.
The Academic Hallmarks and Knowledge Masters mascot is a great auk with an affinity for puns.
Rules and scoring
Each participating school received a password-protected disk (originally a floppy disk, later a CD-ROM) containing the contest questions. Only the first use of the password would generate a valid score report for submission to Academic Hallmarks. Team size was left to each individual school's discretion.
All questions were multiple-choice, with a maximum value of 10 points each. Each question and its category were displayed on screen, with five choices and a 60-second timer. A correct answer on the first try awarded five points, with up to five bonus points depending on the response time. If time expired or an incorrect response was given, the timer was reset to 60 seconds and the team was given a second chance to answer. Two points were awarded for a correct second-chance response, with no bonus.
Bonus points were awarded for correct first-try answers as follows:
The maximum potential score was 1,000 points (5th/6th grade) or 2,000 points (middle school and up), attainable by answering every question correctly on the first try and in less than 7 seconds each.
Teams could take up to three 5-minute breaks during the contest. They could use pencil and paper, but no other resources such as calculators or reference books, and assistance from coaches or spectators was not allowed.
Once a particular contest was over, the participating schools could use a second password to unlock the questions for unlimited use in practice sessions.
See also
Knowledge Bowl
References
GreatAuk.com, the official Academic Hallmarks website.
Educational games
Student quiz competitions
Semiannual events
Education competitions in the United States
|
Kaadhal 2014 () is a 2014 Indian Tamil-language romantic drama film directed by Suganthan and starring Arish Kumar, Neha, and Manikandan. The film is about female empowerment. Boys Manikandan debuted as a villain with this film.
Cast
Soundtrack
The music was composed by F. S. Faizal.https://masstamilan.in/kadhal/
"Maanpola"
"Mailakilli"
"Oh Jinglee"
"Pathikucha"
Reception
Malini Mannath of The New Indian Express opined that "Dealing with a crucial issue, what was needed was a more focused screenplay and mature handling". A critic from Maalaimalar praised the film's novelty and music. A critic from iFlicks praised the film's theme and music while criticised the film's pace. A critic from Dinamalar called the film old-fashioned.
References
External links
2014 films
2014 romantic drama films
Indian romantic drama films
2010s Tamil-language films
|
Black Mountain Poets is a 2015 British comedy film directed by Jamie Adams and starring Alice Lowe, Dolly Wells and Tom Cullen. Largely improvised from Adams’ plot outline, the film won the Student Critics’ Jury Award at the Edinburgh International Film Festival.
Synopsis
Two sisters on-the-run for petty crimes hide out at a poetry retreat in the Black Mountains, Wales impersonating the world renowned poets whose car they stole.
Cast
Alice Lowe as Lisa Walker
Dolly Wells as Clare Walker
Tom Cullen as Richard
Rosa Robson as Louise Cabaye
Richard Elis as Gareth
Laura Patch as Stacey
Hannah Daniel as Alys Wilding
Claire Cage as Terri Wilding
Production
The film marked the third in a trilogy of films by Newport Film School graduate Jamie Adams about modern love, after 2014’s Benny & Jolene and A Wonderful Christmas Time. The film was shot in five days on location in the Welsh Black Mountains.
Release
The film had its world premiere at the Edinburgh International Film Festival in 2015. The film had a limited UK cinema release in April 2016.
Reception
Peter Bradshaw in The Guardian said the film was “flimsy, funny…very silly and likeable” noting that “there are some big laughs, particularly from Alice Lowe” but with little “narrative plausibility”. Guy Lodge in Variety said “Alice Lowe and Dolly Wells are a riot” and described a “deftly escalated farce as humane as it is hilarious”. Neil Young in the Hollywood Reporter saw a “slight but likeable…uneven, shoestring-budgeted charmer” and praises cinematographer Ryan Owen Eddleston‘s demonstrations of the “alluringly elemental Welsh countryside” and praises the performances of Lowe and Wells but feels the film underuses Hannah Daniel and Clare Cage who “are consistently hilarious in their fleeting, intermittent appearances as the bemused, bohemian-bard [Wilding] babes. David Jenkins in Little White Lies (magazine) praises Lowe saying “watching this film is a simple case of waiting for Alice Lowe to appear on screen. If everyone in the cast gives a solid seven out of 10, she’s easily a 12. The camera naturally gravitates towards her, wise to the fact that her reaction to a line of dialogue will likely be funnier than the dialogue itself. She’s hilarious, casually outclassing her fellow players. Even the way she wears a hat is amusing.” Jenkins felt though that the film begins to run out of steam after 30 minutes and the laughs dry up as it transitions from crime caper plot to romance, saying “in its blind search for profundity, it’s a film which loses sight of what makes it interesting in the first place.”
References
External links
2010s English-language films
Films shot in Wales
British romantic drama films
Films directed by Jamie Adams
|
```text
Alternative Names
0
PARAM.SFO
/*
Resident Evil Revelations
*/
#
Invincible
0
xtatu
0 003E66CC 3880FFFF
0 0026A508 38800000
#
Infinite Reload
0
xtatu
0 003EA46C 4082003C
#
1P Hit Kill Ammo Mode
0
xtatu
0 002ACEAC 3860270F
#
Quick Shot Stab Fast
0
xtatu
0 002AF6A0 42C80000
#
AoB Invincible
0
xtatu
B 00010000 04000000
B 4181001463E3000038800001 4181001463E300003880FFFF
B 00010000 04000000
B 4BDA62B9835F0E706343000038800001 4BDA62B9835F0E706343000038800000
#
AoB Infinite Reload
0
xtatu
B 00010000 04000000
B 83FE0EDC63DD00002C1F00094182003C 83FE0EDC63DD00002C1F00094082003C
#
AoB Quick Shot + Stab Fast
0
xtatu
B 00010000 04000000
B your_sha256_hash your_sha256_hash
#
AoB 1P Hit Kill Ammo Mode
0
xtatu
B 00010000 04000000
B your_sha256_hash63840000 your_sha256_hash63840000
#
```
|
```c
/*
*
*/
#include <string.h>
#include <stdlib.h>
#include <zephyr/bluetooth/mesh.h>
#include <zephyr/bluetooth/conn.h>
#include <zephyr/sys/iterable_sections.h>
#include "mesh.h"
#include "net.h"
#include "app_keys.h"
#include "rpl.h"
#include "settings.h"
#include "crypto.h"
#include "proxy.h"
#include "friend.h"
#include "foundation.h"
#include "access.h"
#include "common/bt_str.h"
#define LOG_LEVEL CONFIG_BT_MESH_KEYS_LOG_LEVEL
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(bt_mesh_app_keys);
/* Tracking of what storage changes are pending for App Keys. We track this in
* a separate array here instead of within the respective bt_mesh_app_key
* struct itself, since once a key gets deleted its struct becomes invalid
* and may be reused for other keys.
*/
struct app_key_update {
uint16_t key_idx:12, /* AppKey Index */
valid:1, /* 1 if this entry is valid, 0 if not */
clear:1; /* 1 if key needs clearing, 0 if storing */
};
/* AppKey information for persistent storage. */
struct app_key_val {
uint16_t net_idx;
bool updated;
struct bt_mesh_key val[2];
} __packed;
/** Mesh Application Key. */
struct app_key {
uint16_t net_idx;
uint16_t app_idx;
bool updated;
struct bt_mesh_app_cred {
uint8_t id;
struct bt_mesh_key val;
} keys[2];
};
static struct app_key_update app_key_updates[CONFIG_BT_MESH_APP_KEY_COUNT];
static struct app_key apps[CONFIG_BT_MESH_APP_KEY_COUNT] = {
[0 ... (CONFIG_BT_MESH_APP_KEY_COUNT - 1)] = {
.app_idx = BT_MESH_KEY_UNUSED,
.net_idx = BT_MESH_KEY_UNUSED,
}
};
static struct app_key *app_get(uint16_t app_idx)
{
for (int i = 0; i < ARRAY_SIZE(apps); i++) {
if (apps[i].app_idx == app_idx) {
return &apps[i];
}
}
return NULL;
}
static void clear_app_key(uint16_t app_idx)
{
char path[20];
int err;
snprintk(path, sizeof(path), "bt/mesh/AppKey/%x", app_idx);
err = settings_delete(path);
if (err) {
LOG_ERR("Failed to clear AppKeyIndex 0x%03x", app_idx);
} else {
LOG_DBG("Cleared AppKeyIndex 0x%03x", app_idx);
}
}
static void store_app_key(uint16_t app_idx)
{
const struct app_key *app;
struct app_key_val key;
char path[20];
int err;
snprintk(path, sizeof(path), "bt/mesh/AppKey/%x", app_idx);
app = app_get(app_idx);
if (!app) {
LOG_WRN("ApKeyIndex 0x%03x not found", app_idx);
return;
}
key.net_idx = app->net_idx,
key.updated = app->updated,
memcpy(&key.val[0], &app->keys[0].val, sizeof(struct bt_mesh_key));
memcpy(&key.val[1], &app->keys[1].val, sizeof(struct bt_mesh_key));
err = settings_save_one(path, &key, sizeof(key));
if (err) {
LOG_ERR("Failed to store AppKey %s value", path);
} else {
LOG_DBG("Stored AppKey %s value", path);
}
}
static struct app_key_update *app_key_update_find(uint16_t key_idx,
struct app_key_update **free_slot)
{
struct app_key_update *match;
int i;
match = NULL;
*free_slot = NULL;
for (i = 0; i < ARRAY_SIZE(app_key_updates); i++) {
struct app_key_update *update = &app_key_updates[i];
if (!update->valid) {
*free_slot = update;
continue;
}
if (update->key_idx == key_idx) {
match = update;
}
}
return match;
}
static void update_app_key_settings(uint16_t app_idx, bool store)
{
struct app_key_update *update, *free_slot;
uint8_t clear = store ? 0U : 1U;
LOG_DBG("AppKeyIndex 0x%03x", app_idx);
update = app_key_update_find(app_idx, &free_slot);
if (update) {
update->clear = clear;
bt_mesh_settings_store_schedule(
BT_MESH_SETTINGS_APP_KEYS_PENDING);
return;
}
if (!free_slot) {
if (store) {
store_app_key(app_idx);
} else {
clear_app_key(app_idx);
}
return;
}
free_slot->valid = 1U;
free_slot->key_idx = app_idx;
free_slot->clear = clear;
bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_APP_KEYS_PENDING);
}
static void app_key_evt(struct app_key *app, enum bt_mesh_key_evt evt)
{
STRUCT_SECTION_FOREACH(bt_mesh_app_key_cb, cb) {
cb->evt_handler(app->app_idx, app->net_idx, evt);
}
}
static struct app_key *app_key_alloc(uint16_t app_idx)
{
struct app_key *app = NULL;
for (int i = 0; i < ARRAY_SIZE(apps); i++) {
/* Check for already existing app_key */
if (apps[i].app_idx == app_idx) {
return &apps[i];
}
if (!app && apps[i].app_idx == BT_MESH_KEY_UNUSED) {
app = &apps[i];
}
}
return app;
}
static void app_key_del(struct app_key *app)
{
LOG_DBG("AppIdx 0x%03x", app->app_idx);
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
update_app_key_settings(app->app_idx, false);
}
app_key_evt(app, BT_MESH_KEY_DELETED);
app->net_idx = BT_MESH_KEY_UNUSED;
app->app_idx = BT_MESH_KEY_UNUSED;
bt_mesh_key_destroy(&app->keys[0].val);
bt_mesh_key_destroy(&app->keys[1].val);
memset(app->keys, 0, sizeof(app->keys));
}
static void app_key_revoke(struct app_key *app)
{
if (!app->updated) {
return;
}
bt_mesh_key_destroy(&app->keys[0].val);
memcpy(&app->keys[0], &app->keys[1], sizeof(app->keys[0]));
memset(&app->keys[1], 0, sizeof(app->keys[1]));
app->updated = false;
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
update_app_key_settings(app->app_idx, true);
}
app_key_evt(app, BT_MESH_KEY_REVOKED);
}
uint8_t bt_mesh_app_key_add(uint16_t app_idx, uint16_t net_idx,
const uint8_t key[16])
{
struct app_key *app;
LOG_DBG("net_idx 0x%04x app_idx %04x val %s", net_idx, app_idx, bt_hex(key, 16));
if (!bt_mesh_subnet_get(net_idx)) {
return STATUS_INVALID_NETKEY;
}
app = app_key_alloc(app_idx);
if (!app) {
return STATUS_INSUFF_RESOURCES;
}
if (app->app_idx == app_idx) {
if (app->net_idx != net_idx) {
return STATUS_INVALID_NETKEY;
}
if (bt_mesh_key_compare(key, &app->keys[0].val)) {
return STATUS_IDX_ALREADY_STORED;
}
return STATUS_SUCCESS;
}
if (bt_mesh_app_id(key, &app->keys[0].id)) {
return STATUS_CANNOT_SET;
}
LOG_DBG("AppIdx 0x%04x AID 0x%02x", app_idx, app->keys[0].id);
app->net_idx = net_idx;
app->app_idx = app_idx;
app->updated = false;
if (bt_mesh_key_import(BT_MESH_KEY_TYPE_APP, key, &app->keys[0].val)) {
LOG_ERR("Unable to import application key");
return STATUS_CANNOT_SET;
}
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
LOG_DBG("Storing AppKey persistently");
update_app_key_settings(app->app_idx, true);
}
app_key_evt(app, BT_MESH_KEY_ADDED);
return STATUS_SUCCESS;
}
uint8_t bt_mesh_app_key_update(uint16_t app_idx, uint16_t net_idx,
const uint8_t key[16])
{
struct app_key *app;
struct bt_mesh_subnet *sub;
LOG_DBG("net_idx 0x%04x app_idx %04x val %s", net_idx, app_idx, bt_hex(key, 16));
app = app_get(app_idx);
if (!app) {
return STATUS_INVALID_APPKEY;
}
if (net_idx != BT_MESH_KEY_UNUSED && app->net_idx != net_idx) {
return STATUS_INVALID_BINDING;
}
sub = bt_mesh_subnet_get(app->net_idx);
if (!sub) {
return STATUS_INVALID_NETKEY;
}
/* The AppKey Update message shall generate an error when node
* is in normal operation, Phase 2, or Phase 3 or in Phase 1
* when the AppKey Update message on a valid AppKeyIndex when
* the AppKey value is different.
*/
if (sub->kr_phase != BT_MESH_KR_PHASE_1) {
return STATUS_CANNOT_UPDATE;
}
if (app->updated) {
if (bt_mesh_key_compare(key, &app->keys[1].val)) {
return STATUS_IDX_ALREADY_STORED;
}
return STATUS_SUCCESS;
}
if (bt_mesh_app_id(key, &app->keys[1].id)) {
return STATUS_CANNOT_UPDATE;
}
LOG_DBG("app_idx 0x%04x AID 0x%02x", app_idx, app->keys[1].id);
app->updated = true;
if (bt_mesh_key_import(BT_MESH_KEY_TYPE_APP, key, &app->keys[1].val)) {
LOG_ERR("Unable to import application key");
return STATUS_CANNOT_UPDATE;
}
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
LOG_DBG("Storing AppKey persistently");
update_app_key_settings(app->app_idx, true);
}
app_key_evt(app, BT_MESH_KEY_UPDATED);
return STATUS_SUCCESS;
}
uint8_t bt_mesh_app_key_del(uint16_t app_idx, uint16_t net_idx)
{
struct app_key *app;
LOG_DBG("AppIdx 0x%03x", app_idx);
if (net_idx != BT_MESH_KEY_UNUSED && !bt_mesh_subnet_get(net_idx)) {
return STATUS_INVALID_NETKEY;
}
app = app_get(app_idx);
if (!app) {
/* This could be a retry of a previous attempt that had its
* response lost, so pretend that it was a success.
*/
return STATUS_SUCCESS;
}
if (net_idx != BT_MESH_KEY_UNUSED && net_idx != app->net_idx) {
return STATUS_INVALID_BINDING;
}
app_key_del(app);
return STATUS_SUCCESS;
}
static int app_id_set(struct app_key *app, int key_idx, const struct bt_mesh_key *key)
{
uint8_t raw_key[16];
int err;
err = bt_mesh_key_export(raw_key, key);
if (err) {
return err;
}
err = bt_mesh_app_id(raw_key, &app->keys[key_idx].id);
if (err) {
return err;
}
bt_mesh_key_assign(&app->keys[key_idx].val, key);
return 0;
}
int bt_mesh_app_key_set(uint16_t app_idx, uint16_t net_idx,
const struct bt_mesh_key *old_key, const struct bt_mesh_key *new_key)
{
struct app_key *app;
app = app_key_alloc(app_idx);
if (!app) {
return -ENOMEM;
}
if (app->app_idx == app_idx) {
return 0;
}
LOG_DBG("AppIdx 0x%04x AID 0x%02x", app_idx, app->keys[0].id);
if (app_id_set(app, 0, old_key)) {
return -EIO;
}
if (new_key != NULL && app_id_set(app, 1, new_key)) {
return -EIO;
}
app->net_idx = net_idx;
app->app_idx = app_idx;
app->updated = !!new_key;
return 0;
}
bool bt_mesh_app_key_exists(uint16_t app_idx)
{
for (int i = 0; i < ARRAY_SIZE(apps); i++) {
if (apps[i].app_idx == app_idx) {
return true;
}
}
return false;
}
ssize_t bt_mesh_app_keys_get(uint16_t net_idx, uint16_t app_idxs[], size_t max,
off_t skip)
{
size_t count = 0;
for (int i = 0; i < ARRAY_SIZE(apps); i++) {
struct app_key *app = &apps[i];
if (app->app_idx == BT_MESH_KEY_UNUSED) {
continue;
}
if (net_idx != BT_MESH_KEY_ANY && app->net_idx != net_idx) {
continue;
}
if (skip) {
skip--;
continue;
}
if (count >= max) {
return -ENOMEM;
}
app_idxs[count++] = app->app_idx;
}
return count;
}
int bt_mesh_keys_resolve(struct bt_mesh_msg_ctx *ctx,
struct bt_mesh_subnet **sub,
const struct bt_mesh_key **app_key, uint8_t *aid)
{
struct app_key *app = NULL;
if (BT_MESH_IS_DEV_KEY(ctx->app_idx)) {
/* With device keys, the application has to decide which subnet
* to send on.
*/
*sub = bt_mesh_subnet_get(ctx->net_idx);
if (!*sub) {
LOG_WRN("Unknown NetKey 0x%03x", ctx->net_idx);
return -EINVAL;
}
if (ctx->app_idx == BT_MESH_KEY_DEV_REMOTE &&
!bt_mesh_has_addr(ctx->addr)) {
struct bt_mesh_cdb_node *node;
if (!IS_ENABLED(CONFIG_BT_MESH_CDB)) {
LOG_WRN("No DevKey for 0x%04x", ctx->addr);
return -EINVAL;
}
node = bt_mesh_cdb_node_get(ctx->addr);
if (!node) {
LOG_WRN("No DevKey for 0x%04x", ctx->addr);
return -EINVAL;
}
*app_key = &node->dev_key;
} else {
*app_key = &bt_mesh.dev_key;
}
*aid = 0;
return 0;
}
app = app_get(ctx->app_idx);
if (!app) {
LOG_WRN("Unknown AppKey 0x%03x", ctx->app_idx);
return -EINVAL;
}
*sub = bt_mesh_subnet_get(app->net_idx);
if (!*sub) {
LOG_WRN("Unknown NetKey 0x%03x", app->net_idx);
return -EINVAL;
}
if ((*sub)->kr_phase == BT_MESH_KR_PHASE_2 && app->updated) {
*aid = app->keys[1].id;
*app_key = &app->keys[1].val;
} else {
*aid = app->keys[0].id;
*app_key = &app->keys[0].val;
}
return 0;
}
uint16_t bt_mesh_app_key_find(bool dev_key, uint8_t aid,
struct bt_mesh_net_rx *rx,
int (*cb)(struct bt_mesh_net_rx *rx,
const struct bt_mesh_key *key, void *cb_data),
void *cb_data)
{
int err, i;
if (dev_key) {
/* Attempt remote dev key first, as that is only available for
* provisioner devices, which normally don't interact with nodes
* that know their local dev key.
*/
if (IS_ENABLED(CONFIG_BT_MESH_CDB) &&
rx->net_if != BT_MESH_NET_IF_LOCAL) {
struct bt_mesh_cdb_node *node;
node = bt_mesh_cdb_node_get(rx->ctx.addr);
if (node && !cb(rx, &node->dev_key, cb_data)) {
return BT_MESH_KEY_DEV_REMOTE;
}
}
/** MshPRTv1.1: 3.4.3:
* The Device key is only valid for unicast addresses.
*/
if (BT_MESH_ADDR_IS_UNICAST(rx->ctx.recv_dst)) {
err = cb(rx, &bt_mesh.dev_key, cb_data);
if (!err) {
return BT_MESH_KEY_DEV_LOCAL;
}
#if defined(CONFIG_BT_MESH_RPR_SRV)
if (atomic_test_bit(bt_mesh.flags, BT_MESH_DEVKEY_CAND)) {
err = cb(rx, &bt_mesh.dev_key_cand, cb_data);
if (!err) {
/* MshPRTv1.1: 3.6.4.2:
* If a message is successfully decrypted using the device
* key candidate, the device key candidate should
* permanently replace the original devkey.
*/
bt_mesh_dev_key_cand_activate();
return BT_MESH_KEY_DEV_LOCAL;
}
}
#endif
}
return BT_MESH_KEY_UNUSED;
}
for (i = 0; i < ARRAY_SIZE(apps); i++) {
const struct app_key *app = &apps[i];
const struct bt_mesh_app_cred *cred;
if (app->app_idx == BT_MESH_KEY_UNUSED) {
continue;
}
if (app->net_idx != rx->sub->net_idx) {
continue;
}
if (rx->new_key && app->updated) {
cred = &app->keys[1];
} else {
cred = &app->keys[0];
}
if (cred->id != aid) {
continue;
}
err = cb(rx, &cred->val, cb_data);
if (err) {
continue;
}
return app->app_idx;
}
return BT_MESH_KEY_UNUSED;
}
static void subnet_evt(struct bt_mesh_subnet *sub, enum bt_mesh_key_evt evt)
{
if (evt == BT_MESH_KEY_UPDATED || evt == BT_MESH_KEY_ADDED) {
return;
}
for (int i = 0; i < ARRAY_SIZE(apps); i++) {
struct app_key *app = &apps[i];
if (app->app_idx == BT_MESH_KEY_UNUSED) {
continue;
}
if (app->net_idx != sub->net_idx) {
continue;
}
if (evt == BT_MESH_KEY_DELETED) {
app_key_del(app);
} else if (evt == BT_MESH_KEY_REVOKED) {
app_key_revoke(app);
} else if (evt == BT_MESH_KEY_SWAPPED && app->updated) {
app_key_evt(app, BT_MESH_KEY_SWAPPED);
}
}
}
BT_MESH_SUBNET_CB_DEFINE(app_keys) = {
.evt_handler = subnet_evt,
};
void bt_mesh_app_keys_reset(void)
{
for (int i = 0; i < ARRAY_SIZE(apps); i++) {
struct app_key *app = &apps[i];
if (app->app_idx != BT_MESH_KEY_UNUSED) {
app_key_del(app);
}
}
}
static int app_key_set(const char *name, size_t len_rd,
settings_read_cb read_cb, void *cb_arg)
{
struct app_key_val key;
struct bt_mesh_key val[2];
uint16_t app_idx;
int err;
if (!name) {
LOG_ERR("Insufficient number of arguments");
return -ENOENT;
}
app_idx = strtol(name, NULL, 16);
if (!len_rd) {
return 0;
}
err = bt_mesh_settings_set(read_cb, cb_arg, &key, sizeof(key));
if (err < 0) {
return -EINVAL;
}
/* One extra copying since key.val array is from packed structure
* and might be unaligned.
*/
memcpy(val, key.val, sizeof(key.val));
err = bt_mesh_app_key_set(app_idx, key.net_idx, &val[0],
key.updated ? &val[1] : NULL);
if (err) {
LOG_ERR("Failed to set \'app-key\'");
return err;
}
LOG_DBG("AppKeyIndex 0x%03x recovered from storage", app_idx);
return 0;
}
BT_MESH_SETTINGS_DEFINE(app, "AppKey", app_key_set);
void bt_mesh_app_key_pending_store(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(app_key_updates); i++) {
struct app_key_update *update = &app_key_updates[i];
if (!update->valid) {
continue;
}
update->valid = 0U;
if (update->clear) {
clear_app_key(update->key_idx);
} else {
store_app_key(update->key_idx);
}
}
}
```
|
Forward Township is a township in Butler County, Pennsylvania, United States. The population was 3,164 at the 2020 census.
Geography
Forward Township is located in southwestern Butler County. It is bordered to the north by Connoquenessing Township and the borough of Connoquenessing, at its northeastern corner by Butler Township, to the east by Penn Township, at its southeastern corner by Middlesex Township, to the south by Adams Township and the borough of Callery, at its southwestern corner by Cranberry Township, to the west by Jackson Township and the borough of Evans City, and at its northwest corner by Lancaster Township. The unincorporated communities of Wahlville and Watters are in the township.
Connoquenessing Creek, a tributary of the Beaver River, flows through the northern part of the township from east to west, taking several large bends.
According to the United States Census Bureau, the township has a total area of , of which , or 0.04%, is water.
Demographics
As of the 2000 census, there were 2,687 people, 970 households, and 751 families residing in the township. The population density was . There were 1,089 housing units at an average density of . The racial makeup of the township was 98.77% White, 0.19% African American, 0.22% Native American, 0.56% Asian, 0.11% from other races, and 0.15% from two or more races. Hispanic or Latino of any race were 0.33% of the population.
There were 970 households, out of which 36.1% had children under the age of 18 living with them, 68.2% were married couples living together, 5.5% had a female householder with no husband present, and 22.5% were non-families. 17.2% of all households were made up of individuals, and 6.3% had someone living alone who was 65 years of age or older. The average household size was 2.77 and the average family size was 3.15.
In the township the population was spread out, with 27.6% under the age of 18, 6.3% from 18 to 24, 30.3% from 25 to 44, 24.6% from 45 to 64, and 11.2% who were 65 years of age or older. The median age was 38 years. For every 100 females, there were 108.0 males. For every 100 females age 18 and over, there were 102.5 males.
The median income for a household in the township was $43,542, and the median income for a family was $50,552. Males had a median income of $35,288 versus $25,573 for females. The per capita income for the township was $17,175. About 3.5% of families and 4.9% of the population were below the poverty line, including 4.6% of those under age 18 and 9.0% of those age 65 or over.
References
External links
Forward Township official website
Populated places established in 1795
Pittsburgh metropolitan area
Townships in Butler County, Pennsylvania
Townships in Pennsylvania
|
Stepan Dmitrievich Akimov (1896 – October 29, 1941) was a Soviet general and army commander.
He was born in what is now Pskov Oblast. He fought in the Imperial Russian Army in World War I before going over to the Bolsheviks.
During world War II, he commanded the 48th Army (August 4-31, 1941) and the 43rd Army
(October 10–29, 1941).
He died in a plane crash on October 29, 1941, near the village of Golodyaevka, Penza Region.
He was a recipient of the Order of Lenin, the Order of the Red Banner and the Order of the Red Star. He also received the Jubilee Medal "XX Years of the Workers' and Peasants' Red Army".
Bibliography
1896 births
1941 deaths
People from Pskov Oblast
Soviet lieutenant generals
Russian military personnel of World War I
Soviet military personnel of the Russian Civil War
Soviet military personnel of the Winter War
Soviet military personnel killed in World War II
Recipients of the Order of Lenin
Recipients of the Order of the Red Banner
|
No More Dirty Deals is Johnny Van Zant's début solo album.
Track listing
"No More Dirty Deals" (Johnny Van Zant, Erik Lundgren, Donnie Van Zant) – 5:25
"Coming Home" (J. Van Zant, Robert Gay) - 4:08
"634-5789" (Eddie Floyd, Steve Cropper) – 2:43
"Put My Trust in You" (J. Van Zant, Gay, Robert Morris) – 2:44
"Only the Strong Survive" (J. Van Zant, Marvin Jarret, Gay, Morris) – 4:14
"Hard Luck Story" (J. Van Zant, Lundgren) – 3:08
"Stand Your Ground" (D. Van Zant, J. Van Zant, Gay) – 3:11
"Never Too Late" (J. Van Zant, Lundgren) – 3:44
"Keep On Rollin'" (J. Van Zant, Al Kooper, Danny Clausman, Gay) – 3:27
"Standing in the Darkness" (J. Van Zant, Gay) – 4:57
Personnel
Johnny Van Zant - vocals
Robbie Gay - lead guitar
Erik Lundgren - lead guitar
Danny Clausman - bass guitar
Robbie Morris - drums
Al Kooper - keyboards
1980 debut albums
Polydor Records albums
Albums produced by Al Kooper
|
Anthonie Andriessen (1747–1813) was a Dutch artist. He worked with his brother Jurriaan to paint wallpapers for private houses.
References
1746 births
1813 deaths
Painters from Amsterdam
18th-century Dutch painters
18th-century Dutch male artists
Dutch male painters
19th-century Dutch painters
19th-century Dutch male artists
|
```javascript
'use strict';
require('../register')('pinkie', {Promise: require('pinkie')})
```
|
```c++
//
// immer: immutable data structures for C++
//
// See accompanying file LICENSE or copy at path_to_url
//
#pragma once
#include <immer/config.hpp>
#include <immer/detail/hamts/champ.hpp>
#include <immer/detail/hamts/champ_iterator.hpp>
#include <immer/memory_policy.hpp>
#include <cassert>
#include <functional>
#include <stdexcept>
namespace immer {
template <typename K,
typename T,
typename Hash,
typename Equal,
typename MemoryPolicy,
detail::hamts::bits_t B>
class map_transient;
/*!
* Immutable unordered mapping of values from type `K` to type `T`.
*
* @tparam K The type of the keys.
* @tparam T The type of the values to be stored in the container.
* @tparam Hash The type of a function object capable of hashing
* values of type `T`.
* @tparam Equal The type of a function object capable of comparing
* values of type `T`.
* @tparam MemoryPolicy Memory management policy. See @ref
* memory_policy.
*
* @rst
*
* This container provides a good trade-off between cache locality,
* search, update performance and structural sharing. It does so by
* storing the data in contiguous chunks of :math:`2^{B}` elements.
* When storing big objects, the size of these contiguous chunks can
* become too big, damaging performance. If this is measured to be
* problematic for a specific use-case, it can be solved by using a
* `immer::box` to wrap the type `T`.
*
* **Example**
* .. literalinclude:: ../example/map/intro.cpp
* :language: c++
* :start-after: intro/start
* :end-before: intro/end
*
* @endrst
*
*/
template <typename K,
typename T,
typename Hash = std::hash<K>,
typename Equal = std::equal_to<K>,
typename MemoryPolicy = default_memory_policy,
detail::hamts::bits_t B = default_bits>
class map
{
using value_t = std::pair<K, T>;
using move_t =
std::integral_constant<bool, MemoryPolicy::use_transient_rvalues>;
struct project_value
{
const T& operator()(const value_t& v) const noexcept
{
return v.second;
}
T&& operator()(value_t&& v) const noexcept
{
return std::move(v.second);
}
};
struct project_value_ptr
{
const T* operator()(const value_t& v) const noexcept
{
return &v.second;
}
};
struct combine_value
{
template <typename Kf, typename Tf>
value_t operator()(Kf&& k, Tf&& v) const
{
return {std::forward<Kf>(k), std::forward<Tf>(v)};
}
};
struct default_value
{
const T& operator()() const
{
static T v{};
return v;
}
};
struct error_value
{
const T& operator()() const
{
IMMER_THROW(std::out_of_range{"key not found"});
}
};
struct hash_key
{
auto operator()(const value_t& v) { return Hash{}(v.first); }
template <typename Key>
auto operator()(const Key& v)
{
return Hash{}(v);
}
};
struct equal_key
{
auto operator()(const value_t& a, const value_t& b)
{
return Equal{}(a.first, b.first);
}
template <typename Key>
auto operator()(const value_t& a, const Key& b)
{
return Equal{}(a.first, b);
}
};
struct equal_value
{
auto operator()(const value_t& a, const value_t& b)
{
return Equal{}(a.first, b.first) && a.second == b.second;
}
};
using impl_t =
detail::hamts::champ<value_t, hash_key, equal_key, MemoryPolicy, B>;
public:
using key_type = K;
using mapped_type = T;
using value_type = std::pair<K, T>;
using size_type = detail::hamts::size_t;
using difference_type = std::ptrdiff_t;
using hasher = Hash;
using key_equal = Equal;
using reference = const value_type&;
using const_reference = const value_type&;
using iterator = detail::hamts::
champ_iterator<value_t, hash_key, equal_key, MemoryPolicy, B>;
using const_iterator = iterator;
using transient_type = map_transient<K, T, Hash, Equal, MemoryPolicy, B>;
using memory_policy_type = MemoryPolicy;
/*!
* Constructs a map containing the elements in `values`.
*/
map(std::initializer_list<value_type> values)
: impl_{impl_t::from_initializer_list(values)}
{}
/*!
* Constructs a map containing the elements in the range
* defined by the input iterator `first` and range sentinel `last`.
*/
template <typename Iter,
typename Sent,
std::enable_if_t<detail::compatible_sentinel_v<Iter, Sent>,
bool> = true>
map(Iter first, Sent last)
: impl_{impl_t::from_range(first, last)}
{}
/*!
* Default constructor. It creates a map of `size() == 0`. It
* does not allocate memory and its complexity is @f$ O(1) @f$.
*/
map() = default;
/*!
* Returns an iterator pointing at the first element of the
* collection. It does not allocate memory and its complexity is
* @f$ O(1) @f$.
*/
IMMER_NODISCARD iterator begin() const { return {impl_}; }
/*!
* Returns an iterator pointing just after the last element of the
* collection. It does not allocate and its complexity is @f$ O(1) @f$.
*/
IMMER_NODISCARD iterator end() const
{
return {impl_, typename iterator::end_t{}};
}
/*!
* Returns the number of elements in the container. It does
* not allocate memory and its complexity is @f$ O(1) @f$.
*/
IMMER_NODISCARD size_type size() const { return impl_.size; }
/*!
* Returns `true` if there are no elements in the container. It
* does not allocate memory and its complexity is @f$ O(1) @f$.
*/
IMMER_NODISCARD bool empty() const { return impl_.size == 0; }
/*!
* Returns `1` when the key `k` is contained in the map or `0`
* otherwise. It won't allocate memory and its complexity is
* *effectively* @f$ O(1) @f$.
*
* This overload participates in overload resolution only if
* `Hash::is_transparent` is valid and denotes a type.
*/
template <typename Key,
typename U = Hash,
typename = typename U::is_transparent>
IMMER_NODISCARD size_type count(const Key& k) const
{
return impl_.template get<detail::constantly<size_type, 1>,
detail::constantly<size_type, 0>>(k);
}
/*!
* Returns `1` when the key `k` is contained in the map or `0`
* otherwise. It won't allocate memory and its complexity is
* *effectively* @f$ O(1) @f$.
*/
IMMER_NODISCARD size_type count(const K& k) const
{
return impl_.template get<detail::constantly<size_type, 1>,
detail::constantly<size_type, 0>>(k);
}
/*!
* Returns a `const` reference to the values associated to the key
* `k`. If the key is not contained in the map, it returns a
* default constructed value. It does not allocate memory and its
* complexity is *effectively* @f$ O(1) @f$.
*
* This overload participates in overload resolution only if
* `Hash::is_transparent` is valid and denotes a type.
*/
template <typename Key,
typename U = Hash,
typename = typename U::is_transparent>
IMMER_NODISCARD const T& operator[](const Key& k) const
{
return impl_.template get<project_value, default_value>(k);
}
/*!
* Returns a `const` reference to the values associated to the key
* `k`. If the key is not contained in the map, it returns a
* default constructed value. It does not allocate memory and its
* complexity is *effectively* @f$ O(1) @f$.
*/
IMMER_NODISCARD const T& operator[](const K& k) const
{
return impl_.template get<project_value, default_value>(k);
}
/*!
* Returns a `const` reference to the values associated to the key
* `k`. If the key is not contained in the map, throws an
* `std::out_of_range` error. It does not allocate memory and its
* complexity is *effectively* @f$ O(1) @f$.
*/
template <typename Key,
typename U = Hash,
typename = typename U::is_transparent>
const T& at(const Key& k) const
{
return impl_.template get<project_value, error_value>(k);
}
/*!
* Returns a `const` reference to the values associated to the key
* `k`. If the key is not contained in the map, throws an
* `std::out_of_range` error. It does not allocate memory and its
* complexity is *effectively* @f$ O(1) @f$.
*
* This overload participates in overload resolution only if
* `Hash::is_transparent` is valid and denotes a type.
*/
const T& at(const K& k) const
{
return impl_.template get<project_value, error_value>(k);
}
/*!
* Returns a pointer to the value associated with the key `k`. If
* the key is not contained in the map, a `nullptr` is returned.
* It does not allocate memory and its complexity is *effectively*
* @f$ O(1) @f$.
*
* @rst
*
* .. admonition:: Why doesn't this function return an iterator?
*
* Associative containers from the C++ standard library provide a
* ``find`` method that returns an iterator pointing to the
* element in the container or ``end()`` when the key is missing.
* In the case of an unordered container, the only meaningful
* thing one may do with it is to compare it with the end, to
* test if the find was succesfull, and dereference it. This
* comparison is cumbersome compared to testing for a non-empty
* optional value. Furthermore, for an immutable container,
* returning an iterator would have some additional performance
* cost, with no benefits otherwise.
*
* In our opinion, this function should return a
* ``std::optional<const T&>`` but this construction is not valid
* in any current standard. As a compromise we return a
* pointer, which has similar syntactic properties yet it is
* unfortunately unnecessarily unrestricted.
*
* @endrst
*/
IMMER_NODISCARD const T* find(const K& k) const
{
return impl_.template get<project_value_ptr,
detail::constantly<const T*, nullptr>>(k);
}
/*!
* Returns a pointer to the value associated with the key `k`. If
* the key is not contained in the map, a `nullptr` is returned.
* It does not allocate memory and its complexity is *effectively*
* @f$ O(1) @f$.
*
* This overload participates in overload resolution only if
* `Hash::is_transparent` is valid and denotes a type.
*/
template <typename Key,
typename U = Hash,
typename = typename U::is_transparent>
IMMER_NODISCARD const T* find(const Key& k) const
{
return impl_.template get<project_value_ptr,
detail::constantly<const T*, nullptr>>(k);
}
/*!
* Returns whether the maps are equal.
*/
IMMER_NODISCARD bool operator==(const map& other) const
{
return impl_.template equals<equal_value>(other.impl_);
}
IMMER_NODISCARD bool operator!=(const map& other) const
{
return !(*this == other);
}
/*!
* Returns a map containing the association `value`. If the key is
* already in the map, it replaces its association in the map.
* It may allocate memory and its complexity is *effectively* @f$
* O(1) @f$.
*/
IMMER_NODISCARD map insert(value_type value) const&
{
return impl_.add(std::move(value));
}
IMMER_NODISCARD decltype(auto) insert(value_type value) &&
{
return insert_move(move_t{}, std::move(value));
}
/*!
* Returns a map containing the association `(k, v)`. If the key
* is already in the map, it replaces its association in the map.
* It may allocate memory and its complexity is *effectively* @f$
* O(1) @f$.
*/
IMMER_NODISCARD map set(key_type k, mapped_type v) const&
{
return impl_.add({std::move(k), std::move(v)});
}
IMMER_NODISCARD decltype(auto) set(key_type k, mapped_type v) &&
{
return set_move(move_t{}, std::move(k), std::move(v));
}
/*!
* Returns a map replacing the association `(k, v)` by the
* association new association `(k, fn(v))`, where `v` is the
* currently associated value for `k` in the map or a default
* constructed value otherwise. It may allocate memory
* and its complexity is *effectively* @f$ O(1) @f$.
*/
template <typename Fn>
IMMER_NODISCARD map update(key_type k, Fn&& fn) const&
{
return impl_
.template update<project_value, default_value, combine_value>(
std::move(k), std::forward<Fn>(fn));
}
template <typename Fn>
IMMER_NODISCARD decltype(auto) update(key_type k, Fn&& fn) &&
{
return update_move(move_t{}, std::move(k), std::forward<Fn>(fn));
}
/*!
* Returns a map replacing the association `(k, v)` by the association new
* association `(k, fn(v))`, where `v` is the currently associated value for
* `k` in the map. It does nothing if `k` is not present in the map. It
* may allocate memory and its complexity is *effectively* @f$ O(1) @f$.
*/
template <typename Fn>
IMMER_NODISCARD map update_if_exists(key_type k, Fn&& fn) const&
{
return impl_.template update_if_exists<project_value, combine_value>(
std::move(k), std::forward<Fn>(fn));
}
template <typename Fn>
IMMER_NODISCARD decltype(auto) update_if_exists(key_type k, Fn&& fn) &&
{
return update_if_exists_move(
move_t{}, std::move(k), std::forward<Fn>(fn));
}
/*!
* Returns a map without the key `k`. If the key is not
* associated in the map it returns the same map. It may allocate
* memory and its complexity is *effectively* @f$ O(1) @f$.
*/
IMMER_NODISCARD map erase(const K& k) const& { return impl_.sub(k); }
IMMER_NODISCARD decltype(auto) erase(const K& k) &&
{
return erase_move(move_t{}, k);
}
/*!
* Returns a @a transient form of this container, an
* `immer::map_transient`.
*/
IMMER_NODISCARD transient_type transient() const&
{
return transient_type{impl_};
}
IMMER_NODISCARD transient_type transient() &&
{
return transient_type{std::move(impl_)};
}
/*!
* Returns a value that can be used as identity for the container. If two
* values have the same identity, they are guaranteed to be equal and to
* contain the same objects. However, two equal containers are not
* guaranteed to have the same identity.
*/
void* identity() const { return impl_.root; }
// Semi-private
const impl_t& impl() const { return impl_; }
private:
friend transient_type;
map&& insert_move(std::true_type, value_type value)
{
impl_.add_mut({}, std::move(value));
return std::move(*this);
}
map insert_move(std::false_type, value_type value)
{
return impl_.add(std::move(value));
}
map&& set_move(std::true_type, key_type k, mapped_type m)
{
impl_.add_mut({}, {std::move(k), std::move(m)});
return std::move(*this);
}
map set_move(std::false_type, key_type k, mapped_type m)
{
return impl_.add({std::move(k), std::move(m)});
}
template <typename Fn>
map&& update_move(std::true_type, key_type k, Fn&& fn)
{
impl_.template update_mut<project_value, default_value, combine_value>(
{}, std::move(k), std::forward<Fn>(fn));
return std::move(*this);
}
template <typename Fn>
map update_move(std::false_type, key_type k, Fn&& fn)
{
return impl_
.template update<project_value, default_value, combine_value>(
std::move(k), std::forward<Fn>(fn));
}
template <typename Fn>
map&& update_if_exists_move(std::true_type, key_type k, Fn&& fn)
{
impl_.template update_if_exists_mut<project_value, combine_value>(
{}, std::move(k), std::forward<Fn>(fn));
return std::move(*this);
}
template <typename Fn>
map update_if_exists_move(std::false_type, key_type k, Fn&& fn)
{
return impl_.template update_if_exists<project_value, combine_value>(
std::move(k), std::forward<Fn>(fn));
}
map&& erase_move(std::true_type, const key_type& value)
{
impl_.sub_mut({}, value);
return std::move(*this);
}
map erase_move(std::false_type, const key_type& value)
{
return impl_.sub(value);
}
map(impl_t impl)
: impl_(std::move(impl))
{}
impl_t impl_ = impl_t::empty();
};
static_assert(std::is_nothrow_move_constructible<map<int, int>>::value,
"map is not nothrow move constructible");
static_assert(std::is_nothrow_move_assignable<map<int, int>>::value,
"map is not nothrow move assignable");
} // namespace immer
```
|
The HITAC S-820 is a family of vector supercomputers developed, manufactured and marketed by Hitachi. Announced in July 1987, it was Hitachi's second supercomputer, succeeding the HITAC S-810. The S-820 is categorized as a second generation Japanese supercomputer.
The S-820 system has both a scalar and vector processor, similar to the architecture of the S-810. The scalar processor is based on the Hitachi M-series mainframe processor, so is compatible with its operating system. The S-820 was reported to have a theoretical peak performance of 2 GFLOPS, and a theoretical maximum computational performance of 3 GFLOPS.
Initially the S-820 was available in two variations: the S-820 model 80 and the S-820 model 60 (hereafter S-820/80 and S-820/60). The S-820/80 had double the vector computational capability, as well as more storage capability, compared to the S-820/60. The peak performance of the S-820/80 was 3 GFLOPS, and that of the S-820/60 as 1.5 GFLOPS.
There were five models. The first two, the mid-range S-820/60 with a peak performance of 1.5 GFLOPS and the top-end S-820/80 with a peak performance of 3.0 GFLOPS, were announced in July 1987. These two models differ in the number of vector pipelines installed. In May 1988, the S-820/20 and S-820/40 were announced, followed by the S-820/15 in November 1989.
A team from the Institute for Supercomputing Research (Tokyo) and the Los Alamos National Laboratory benchmarked the S-820/80 against the similar generation NEC SX-2 and Cray X-MP/416, as well as the S-810, during early 1988. They concluded that the S-820 was "a great deal faster in vector mode than any other supercomputer we have measured".
See also
HITAC S-810
HITAC S-3000
Supercomputing in Japan
References
Hitachi supercomputers
Vector supercomputers
|
Michael McMullan is a sportscaster and radio presenter from County Antrim, Northern Ireland. He presented Premier League Live (formerly Premiership Live) each Saturday on national radio station Today FM. On each occasion he was joined in studio by BBC television analyst and former Republic of Ireland international footballer, Mark Lawrenson.
Career
McMullan joined Premiership Live in 2001, six years before it underwent a name change to Premier League Live. He presented Today FM's coverage of the 2002 FIFA World Cup from Japan/South Korea.
McMullan also features on The Ray D'Arcy Show on Today FM each Monday, where he discusses the previous weekend's sporting events.
In July 2007, he achieved the personal highlight of his reporting career, when he stood at the back of the 18th green at Carnoustie as the Irish golfer, Pádraig Harrington, holed the winning putt in The Open Championship.
In 2015, it was announced that McMullan had left Today FM.
Personal life
Originally from County Antrim, McMullan has since moved to Dublin. His favourite sports are football, snooker and golf (he often has disagreements with D'Arcy over their differing opinions on the latter). He appeared on front of a newspaper with incoming Taoiseach, then Minister for Finance, Bertie Ahern in 1992, after winning a competition.
References
External links
The Ray D'Arcy Show contributions
Year of birth missing (living people)
Living people
Irish association football commentators
Broadcasters from County Antrim
Today FM presenters
|
The Slovene Writers' Association () is a non-profit association of Slovene writers based in Ljubljana.
The association was founded on 21 April 1872 in Ljubljana at the initiative of Davorin Trstenjak who also became its first president. The statue of the organization was confirmed by the Duchy of Carniola on 10 May 1872. The constituent congress was held on 14 September 1872 while regular meetings took place in the Hotel Evropa until the 1885. It operated under various names over the years and re-adopted its original name Društvo slovenskih pisateljev in 1968. It provides a platform for writers, poets, playwrights and essayists who participate to promote common cultural and social inetersts.
The association has also made considerable efforts in promoting Slovene literature abroad. Its international activities include maintaining contacts with cultural institutions and writers' societies all around the world and collaborating with literary journals and magazines. Its own publication Litterae slovenicae (called Le Livre Slovène before 1991) publishes excerpts, poems and short stories by Slovene writers in translation, making Slovene literature available to a world audience.
It annually bestows the Vilenica Prize to a Central European author for his or her achievements in the field of literature and essay writing at the festival which takes place in the Vilenica Cave in the Slovenian Littoral. Since 1986 it has also annually awarded the Jenko Award for the best poetry collection in Slovene published in the previous two years.
Presidents
Davorin Trstenjak 1872
Rajko Perušek 1895–1915
Anton Funtek
Alojz Gradnik
Oton Župančič
France Koblar 1938–1945
Miško Kranjec (2 terms)
France Bevk (2 terms)
Ivan Potrč (2 terms)
Mile Klopčič
Beno Zupančič
Matej Bor 1959–1961
Anton Ingolič
Mira Mihelič
Janez Menart
Ciril Kosmač
Tone Pavček 1979–1983
Tone Partljič 1983–1987
Rudi Šeligo 1987–1991
Dane Zajc 1991–1995
Evald Flisar 1995–2001 (3 terms)
Tone Peršak 2001–2003
Vlado Žabot 2003–2007 (2 terms)
Slavko Pregl 2007–2009
Milan Jesih 2009–2011
Veno Taufer 2011–2014
Ivo Svetina 2014–
See also
Association of Writers of Yugoslavia
References
Slovenian writers' organizations
1872 establishments in Austria-Hungary
Organizations established in 1872
Organizations based in Ljubljana
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.