You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
364 lines
19 KiB
HTML
364 lines
19 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>Compiler Explorer</title>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link href="ext/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="ext/codemirror/codemirror.css" rel="stylesheet">
|
|
<link href="ext/golden-layout/goldenlayout-base.css" rel="stylesheet">
|
|
<link href="ext/golden-layout/goldenlayout-light-theme.css" rel="stylesheet">
|
|
<link href="gcc.css" rel="stylesheet">
|
|
<script src="client-options.js"></script>
|
|
<script src="ext/codemirror/codemirror.js"></script>
|
|
<script src="asm-mode.js"></script>
|
|
<script src="ext/jquery/jquery-2.2.2.min.js"></script>
|
|
<script src="ext/golden-layout/goldenlayout.min.js"></script>
|
|
<script src="ext/jquery-ui-1.11.4/jquery-ui.min.js"></script>
|
|
<script src="ext/rison.js"></script>
|
|
<script src="ext/underscore-min.js"></script>
|
|
<script src="ext/clipboard.min.js"></script>
|
|
<script src="compiler.js"></script>
|
|
<script src="gcc.js"></script>
|
|
<script src="ext/bootstrap/js/bootstrap.min.js"></script>
|
|
<script src="ext/lz-string/lz-string-1.3.3-min.js"></script>
|
|
<script type="text/javascript">
|
|
var _gaq = _gaq || [];
|
|
_gaq.push(['_setAccount', OPTIONS.googleAnalyticsAccount]);
|
|
_gaq.push(['_trackPageview']);
|
|
|
|
setTimeout(function () {
|
|
"use strict";
|
|
function create_script_element(id, url) {
|
|
var el = document.createElement('script');
|
|
el.type = 'text/javascript';
|
|
el.async = true;
|
|
el.id = id;
|
|
el.src = url;
|
|
var s = document.getElementsByTagName('script')[0];
|
|
s.parentNode.insertBefore(el, s);
|
|
}
|
|
|
|
create_script_element('urlshortener', 'urlshorten-' + OPTIONS.urlshortener + ".js");
|
|
if (OPTIONS.googleAnalyticsEnabled)
|
|
create_script_element('ga', ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js');
|
|
if (OPTIONS.sharingEnabled) {
|
|
create_script_element('gp', 'https://apis.google.com/js/plusone.js');
|
|
create_script_element('twitter-wjs', '//platform.twitter.com/widgets.js');
|
|
(function(document, i) {
|
|
var f,s=document.getElementById(i);
|
|
f=document.createElement('iframe');
|
|
f.src='//api.flattr.com/button/view/?uid=mattgodbolt&button=compact&url='+encodeURIComponent(document.URL);
|
|
f.title='Flattr';
|
|
f.height=20;
|
|
f.width=110;
|
|
f.style.borderWidth=0;
|
|
s.appendChild(f);
|
|
}(document, 'flattr_button'));
|
|
}
|
|
}, 0);
|
|
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="navbar navbar-inverse">
|
|
<div class="container-fluid">
|
|
<div class="navbar-header">
|
|
<a class="navbar-brand" href="#">Compiler Explorer - <span class="language-name"></span></a>
|
|
</div>
|
|
<div class="navbar-collapse collapse">
|
|
<ul class="nav navbar-nav navbar-right">
|
|
<li class="if-github-enabled">
|
|
<a href="https://github.com/mattgodbolt/gcc-explorer">Source on GitHub</a>
|
|
</li>
|
|
<li class="dropdown if-share-enabled">
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Donate<b class="caret"></b></a>
|
|
<ul class="dropdown-menu">
|
|
<li class="navbar-text"><a href="https://www.changetip.com/tipme/mattgodbolt">ChangeTip.Me</a></li>
|
|
<li class="navbar-text" id="flattr_button"></li>
|
|
</ul>
|
|
</li>
|
|
<li class="dropdown if-share-enabled">
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Share<b class="caret"></b></a>
|
|
<ul class="dropdown-menu">
|
|
<li class="social">
|
|
<g:plusone annotation="inline" width="150"></g:plusone>
|
|
</li>
|
|
<li class="social"><a href="https://twitter.com/share" class="twitter-share-button"
|
|
data-via="mattgodbolt">Tweet</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="dropdown">
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">About<b class="caret"></b></a>
|
|
<ul class="dropdown-menu">
|
|
<li><a href="https://plus.google.com/112384289668860490877" rel="publisher">Google+ page</a>
|
|
</li>
|
|
<li><a href="https://plus.google.com/105166465490735292917" rel="author">About Matt</a></li>
|
|
<li><a href="mailto:matt@godbolt.org">Contact Matt</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="codeEditor" class="template">
|
|
<textarea>// Type your code here, or load an example.</textarea>
|
|
</div>
|
|
|
|
<div id="compiler" class="template">
|
|
<div class="panel-body">
|
|
<div class="params">
|
|
<form class="well well-sm form-inline">
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<td class="dropdown compilers-container">
|
|
<button type="button" title="Compiler to use" class="btn btn-default dropdown-toggle compiler-selection" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
<span class="compiler">g++</span>
|
|
<span class="caret"></span>
|
|
</button>
|
|
<ul class="dropdown-menu compilers">
|
|
</ul>
|
|
</td>
|
|
<td>
|
|
<input accesskey="" title="Options to pass to compiler" class="compiler-options" placeholder="compiler options" type="text" value="" style="width:90%">
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
</div>
|
|
<div class="asm">
|
|
<textarea>Awaiting...</textarea>
|
|
</div>
|
|
<div class="output">
|
|
<div class="result">
|
|
<div class="topbar">Compiler output — <span class="compilerVersion"></span></div>
|
|
<div class="output">
|
|
<div class="template"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container-fluid" id="#root"><!--
|
|
<ul id="draggablePanelList" class="list-unstyled">
|
|
<li class="panel panel-primary col-md-3">
|
|
<div class="panel-heading"><span class="title">Code editor</span></div>
|
|
<div class="panel-body">
|
|
<div id="commonParams">
|
|
<form class="well form-inline files">
|
|
<div>
|
|
<label>Source: <select class="source"></select></label>
|
|
<label>Name: <select class="filename"></select></label>
|
|
<button id="new-slot" class="btn btn-sm" title="Open a new slot.">New slot</button>
|
|
<button id="new-diff" class="btn btn-sm" title="Open a new diff.">New diff</button>
|
|
</div>
|
|
<div class="btn-group btn-group-sm">
|
|
<button class="btn btn-sm load">Load</button>
|
|
<button class="btn btn-sm save">Save</button>
|
|
<button class="btn btn-sm saveas">Save as...</button>
|
|
<button class="btn btn-sm fulllink" title="Permanent, full URL to this page">Full link</button>
|
|
<button class="btn btn-sm shortlink" title="Permanent link to this page as a short link">Short link</button>
|
|
</div>
|
|
<div class="btn-group btn-group-sm filter">
|
|
<button class="btn btn-sm" type="button" value="binary"
|
|
title="Compile to binary and disassemble the output">Binary
|
|
</button>
|
|
<button class="btn btn-sm active nonbinary" type="button"
|
|
title="Filter unused labels from the output" value="labels">Unused labels
|
|
</button>
|
|
<button class="btn btn-sm active nonbinary" type="button"
|
|
title="Filter all assembler directives from the output" value="directives">Directives
|
|
</button>
|
|
<button class="btn btn-sm active nonbinary" type="button"
|
|
title="Remove all lines which are only comments from the output" value="commentOnly">
|
|
Comment-only lines
|
|
</button>
|
|
<button class="btn btn-sm" type="button" title="Output disassembly in Intel syntax"
|
|
value="intel">Intel syntax
|
|
</button>
|
|
<button class="btn btn-sm" type="button"
|
|
title="Colourise lines so one can see how the source maps to the output"
|
|
value="colouriseAsm">Colourise
|
|
</button>
|
|
</div>
|
|
<div class="collapse permalink-collapse">
|
|
<div class="input-group input-group-sm permalink">
|
|
<input type="text" class="form-control input-sm" placeholder="Loading" readonly id="permalink" size="1024">
|
|
<span class="input-group-btn">
|
|
<button class="btn btn-sm btn-default clippy" type="button" data-clipboard-target="#permalink"
|
|
title="Copy to clipboard">
|
|
<img src="ext/clippy.svg" class="clippy" width="13px" alt="Copy to clipboard">
|
|
</button>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="editor">
|
|
<div class="topbar indented">
|
|
Code editor
|
|
<span class="pull-right input-group input-group-sm">
|
|
<button accesskey="a" title="Automatically build when you stop typing"
|
|
class="btn btn-default btn-sm autocompile active">
|
|
<span class="glyphicon glyphicon-play-circle"></span>
|
|
</button>
|
|
</span>
|
|
</div>
|
|
<textarea>// Type your code here, or load an example.</textarea>
|
|
</div>
|
|
|
|
<div class="modal fade" id="saveDialog">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
|
aria-hidden="true">×</span></button>
|
|
<h4>Save as...</h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
<label>Filename: <input class="save-filename" style="width: 30em;" type="text"></label>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<a href="#" data-dismiss="modal" class="btn btn-default">Cancel</a>
|
|
<a href="#" class="btn btn-primary save">Save</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
|
|
<li class="panel panel-primary col-md-3 template slot" id="slotTemplate">
|
|
<div class="panel-heading">
|
|
<span class="title">Slot template (should *not* be visible)</span>
|
|
<span class="closeButton unicodeCross unselectable characterIcon">✖</span>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="params">
|
|
<form class="well well-sm form-inline">
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<p class="leaderSlotIcon unselectable characterIcon unselectedCharacterIcon">☆</p>
|
|
<td class="dropdown compilers-container">
|
|
<!– the accesskey is set in static/compiler.js –>
|
|
<button accesskey="" type="button" title="Compiler to use (alt-C)" class="btn btn-default dropdown-toggle compiler-selection" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
<span class="compiler">g++</span>
|
|
<span class="caret"></span>
|
|
</button>
|
|
<ul class="dropdown-menu compilers">
|
|
</ul>
|
|
</td>
|
|
<td>
|
|
<!– the accesskey is set in static/compiler.js –>
|
|
<input accesskey="" title="Options to pass to compiler (alt-O)" class="compiler-options" placeholder="compiler options" type="text" value="" style="width:90%">
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="btn-group btn-group-sm filter">
|
|
<!– Place slot-specific buttons here. –>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="asm">
|
|
<div class="topbar indented">Assembly output</div>
|
|
<textarea>Awaiting...</textarea>
|
|
</div>
|
|
<div class="output">
|
|
<div class="result">
|
|
<div class="topbar">Compiler output — <span class="compilerVersion"></span></div>
|
|
<div class="output">
|
|
<div class="template"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<li class="panel panel-primary col-md-3 template diff" id="diffTemplate">
|
|
<div class="panel-heading"><span class="title">Diff template (should *not* be visible)</span><span class="closeButton unicodeCross unselectable characterIcon">✖</span></div>
|
|
<div class="panel-body">
|
|
<div class="params">
|
|
<form class="well well-sm form-inline">
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<td class="dropdown compilers-container before">
|
|
<button type="button"
|
|
title="Slot before" class="btn btn-default dropdown-toggle diff-before-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
<span class="slotName">before</span>
|
|
<span class="caret"></span>
|
|
</button>
|
|
<ul class="dropdown-menu slotNameList">
|
|
</ul>
|
|
</td>
|
|
<td> <span class="compilers-container unicode-arrow unselectable" >⇒</span> </td>
|
|
<td class="dropdown compilers-container after">
|
|
<button type="button"
|
|
title="Slot after" class="btn btn-default dropdown-toggle diff-after-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
<span class="slotName">after</span>
|
|
<span class="caret"></span>
|
|
</button>
|
|
<ul class="dropdown-menu slotNameList">
|
|
</ul>
|
|
</td>
|
|
<td> <span class="compilers-container unicode-arrow reverse-diff unselectable characterIcon">⇆</span> </td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
</div>
|
|
<div class="diffText">
|
|
<div class="topbar indented">Diff output</div>
|
|
<textarea>Awaiting...</textarea>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
|
|
</ul>
|
|
--></div>
|
|
|
|
<div class="template lang c">// Type your code here, or load an example.
|
|
int square(int num) {
|
|
return num * num;
|
|
}
|
|
</div>
|
|
<div class="template lang rust">// Type your code here, or load an example.
|
|
pub fn square(num: i32) -> i32 {
|
|
num * num
|
|
}
|
|
</div>
|
|
<div class="template lang go">// Type your code here, or load an example.
|
|
// Your function name should start with a capital letter.
|
|
package main
|
|
|
|
func Square(x int) int {
|
|
return x * x
|
|
}
|
|
|
|
func main() {}
|
|
</div>
|
|
<div class="template lang d">// Type your code here, or load an example.
|
|
int square(int num) {
|
|
return num * num;
|
|
}
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$(function () {
|
|
if (!OPTIONS.sharingEnabled)
|
|
$('.if-share-enabled').remove();
|
|
|
|
if (!OPTIONS.githubEnabled)
|
|
$('.if-github-enabled').remove();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|