Skip to content

Commit d80f41d

Browse files
author
Serge Barral
committed
Really really add etf and etf-cpp. Maybe
1 parent a30bc88 commit d80f41d

File tree

2,530 files changed

+19918
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,530 files changed

+19918
-0
lines changed

etf-cpp/_FontAwesome/css/font-awesome.css

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
135 KB
Binary file not shown.
Binary file not shown.

etf-cpp/_FontAwesome/fonts/fontawesome-webfont.svg

+640
Loading
Binary file not shown.
Binary file not shown.
Binary file not shown.

etf-cpp/book.css

+794
Large diffs are not rendered by default.

etf-cpp/book.js

+232
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
$( document ).ready(function() {
2+
3+
// url
4+
var url = window.location.pathname;
5+
6+
// Fix back button cache problem
7+
window.onunload = function(){};
8+
9+
// Set theme
10+
var theme = localStorage.getItem('theme');
11+
if (theme === null) { theme = 'light'; }
12+
13+
set_theme(theme);
14+
15+
16+
// Syntax highlighting Configuration
17+
hljs.configure({
18+
tabReplace: ' ', // 4 spaces
19+
languages: [], // Languages used for auto-detection
20+
});
21+
22+
$('code').each(function(i, block) {
23+
hljs.highlightBlock(block);
24+
});
25+
26+
var KEY_CODES = {
27+
PREVIOUS_KEY: 37,
28+
NEXT_KEY: 39
29+
};
30+
31+
$(document).on('keydown', function (e) {
32+
switch (e.keyCode) {
33+
case KEY_CODES.NEXT_KEY:
34+
e.preventDefault();
35+
if($('.nav-chapters.next').length) {
36+
window.location.href = $('.nav-chapters.next').attr('href');
37+
}
38+
break;
39+
case KEY_CODES.PREVIOUS_KEY:
40+
e.preventDefault();
41+
if($('.nav-chapters.previous').length) {
42+
window.location.href = $('.nav-chapters.previous').attr('href');
43+
}
44+
break;
45+
}
46+
});
47+
48+
// Interesting DOM Elements
49+
var html = $("html");
50+
var sidebar = $("#sidebar");
51+
var page_wrapper = $("#page-wrapper");
52+
var content = $("#content");
53+
54+
55+
// Add anchors for all content headers
56+
content.find("h1, h2, h3, h4, h5").wrap(function(){
57+
var wrapper = $("<a class=\"header\">");
58+
wrapper.attr("name", $(this).text());
59+
// Add so that when you click the link actually shows up in the url bar...
60+
// Remove any existing anchor then append the new one
61+
// ensuring eg. no spaces are present within it ie. they become %20
62+
wrapper.attr("href", $(location).attr('href').split("#")[0] + "#" + encodeURIComponent($(this).text().trim()) );
63+
return wrapper;
64+
});
65+
66+
67+
// Toggle sidebar
68+
$("#sidebar-toggle").click(function(event){
69+
if ( html.hasClass("sidebar-hidden") ) {
70+
html.removeClass("sidebar-hidden").addClass("sidebar-visible");
71+
localStorage.setItem('sidebar', 'visible');
72+
} else if ( html.hasClass("sidebar-visible") ) {
73+
html.removeClass("sidebar-visible").addClass("sidebar-hidden");
74+
localStorage.setItem('sidebar', 'hidden');
75+
} else {
76+
if(sidebar.position().left === 0){
77+
html.addClass("sidebar-hidden");
78+
localStorage.setItem('sidebar', 'hidden');
79+
} else {
80+
html.addClass("sidebar-visible");
81+
localStorage.setItem('sidebar', 'visible');
82+
}
83+
}
84+
});
85+
86+
87+
// Scroll sidebar to current active section
88+
var activeSection = sidebar.find(".active");
89+
if(activeSection.length) {
90+
sidebar.scrollTop(activeSection.offset().top);
91+
}
92+
93+
94+
// Print button
95+
$("#print-button").click(function(){
96+
var printWindow = window.open("print.html");
97+
});
98+
99+
if( url.substring(url.lastIndexOf('/')+1) == "print.html" ) {
100+
window.print();
101+
}
102+
103+
104+
// Theme button
105+
$("#theme-toggle").click(function(){
106+
if($('.theme-popup').length) {
107+
$('.theme-popup').remove();
108+
} else {
109+
var popup = $('<div class="theme-popup"></div>')
110+
.append($('<div class="theme" id="light">Light <span class="default">(default)</span><div>'))
111+
.append($('<div class="theme" id="rust">Rust</div>'))
112+
.append($('<div class="theme" id="coal">Coal</div>'))
113+
.append($('<div class="theme" id="navy">Navy</div>'));
114+
115+
116+
popup.insertAfter(this);
117+
118+
$('.theme').click(function(){
119+
var theme = $(this).attr('id');
120+
121+
set_theme(theme);
122+
});
123+
}
124+
125+
});
126+
127+
function set_theme(theme) {
128+
if (theme == 'coal' || theme == 'navy') {
129+
$("[href='tomorrow-night.css']").prop('disabled', false);
130+
$("[href='highlight.css']").prop('disabled', true);
131+
} else {
132+
$("[href='tomorrow-night.css']").prop('disabled', true);
133+
$("[href='highlight.css']").prop('disabled', false);
134+
}
135+
136+
localStorage.setItem('theme', theme);
137+
138+
$('body').removeClass().addClass(theme);
139+
}
140+
141+
142+
// Hide Rust code lines prepended with a specific character
143+
var hiding_character = "#";
144+
145+
$("code.language-rust").each(function(i, block){
146+
147+
var code_block = $(this);
148+
var pre_block = $(this).parent();
149+
// hide lines
150+
var lines = code_block.html().split("\n");
151+
var first_non_hidden_line = false;
152+
var lines_hidden = false;
153+
154+
for(var n = 0; n < lines.length; n++){
155+
if($.trim(lines[n])[0] == hiding_character){
156+
if(first_non_hidden_line){
157+
lines[n] = "<span class=\"hidden\">" + "\n" + lines[n].replace(/(\s*)#/, "$1") + "</span>";
158+
}
159+
else {
160+
lines[n] = "<span class=\"hidden\">" + lines[n].replace(/(\s*)#/, "$1") + "\n" + "</span>";
161+
}
162+
lines_hidden = true;
163+
}
164+
else if(first_non_hidden_line) {
165+
lines[n] = "\n" + lines[n];
166+
}
167+
else {
168+
first_non_hidden_line = true;
169+
}
170+
}
171+
code_block.html(lines.join(""));
172+
173+
// If no lines were hidden, return
174+
if(!lines_hidden) { return; }
175+
176+
// add expand button
177+
pre_block.prepend("<div class=\"buttons\"><i class=\"fa fa-expand\"></i></div>");
178+
179+
pre_block.find("i").click(function(e){
180+
if( $(this).hasClass("fa-expand") ) {
181+
$(this).removeClass("fa-expand").addClass("fa-compress");
182+
pre_block.find("span.hidden").removeClass("hidden").addClass("unhidden");
183+
}
184+
else {
185+
$(this).removeClass("fa-compress").addClass("fa-expand");
186+
pre_block.find("span.unhidden").removeClass("unhidden").addClass("hidden");
187+
}
188+
});
189+
});
190+
191+
192+
// Process playpen code blocks
193+
$(".playpen").each(function(block){
194+
var pre_block = $(this);
195+
// Add play button
196+
var buttons = pre_block.find(".buttons");
197+
if( buttons.length === 0 ) {
198+
pre_block.prepend("<div class=\"buttons\"></div>");
199+
buttons = pre_block.find(".buttons");
200+
}
201+
buttons.prepend("<i class=\"fa fa-play play-button\"></i>");
202+
203+
buttons.find(".play-button").click(function(e){
204+
run_rust_code(pre_block);
205+
});
206+
});
207+
208+
209+
});
210+
211+
212+
function run_rust_code(code_block) {
213+
var result_block = code_block.find(".result");
214+
if(result_block.length === 0) {
215+
code_block.append("<code class=\"result hljs language-bash\"></code>");
216+
result_block = code_block.find(".result");
217+
}
218+
219+
result_block.text("Running...");
220+
221+
$.ajax({
222+
url: "https://play.rust-lang.org/evaluate.json",
223+
method: "POST",
224+
crossDomain: true,
225+
dataType: "json",
226+
contentType: "application/json",
227+
data: JSON.stringify({version: "stable", optimize: "0", code: code_block.find(".language-rust").text() }),
228+
success: function(response){
229+
result_block.text(response.result);
230+
}
231+
});
232+
}

etf-cpp/distribution.html

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<!DOCTYPE HTML>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title></title>
6+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
7+
<meta name="description" content="">
8+
<meta name="viewport" content="width=device-width, initial-scale=1">
9+
10+
<base href="">
11+
12+
<link rel="stylesheet" href="book.css">
13+
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
14+
15+
<link rel="shortcut icon" href="favicon.png">
16+
17+
<!-- Font Awesome -->
18+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
19+
20+
<link rel="stylesheet" href="highlight.css">
21+
<link rel="stylesheet" href="tomorrow-night.css">
22+
23+
<!-- MathJax -->
24+
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
25+
26+
<!-- Fetch JQuery from CDN but have a local fallback -->
27+
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
28+
<script>
29+
if (typeof jQuery == 'undefined') {
30+
document.write(unescape("%3Cscript src='jquery.js'%3E%3C/script%3E"));
31+
}
32+
</script>
33+
</head>
34+
<body class="light">
35+
<!-- Set the theme before any content is loaded, prevents flash -->
36+
<script type="text/javascript">
37+
var theme = localStorage.getItem('theme');
38+
if (theme == null) { theme = 'light'; }
39+
$('body').removeClass().addClass(theme);
40+
</script>
41+
42+
<!-- Hide / unhide sidebar before it is displayed -->
43+
<script type="text/javascript">
44+
var sidebar = localStorage.getItem('sidebar');
45+
if (sidebar === "hidden") { $("html").addClass("sidebar-hidden") }
46+
else if (sidebar === "visible") { $("html").addClass("sidebar-visible") }
47+
</script>
48+
49+
<div id="sidebar" class="sidebar">
50+
<ul class="chapter"><li><a href="introduction.html"><strong>1.</strong> Introduction</a></li><li><a href="distribution.html" class="active"><strong>2.</strong> &lt;etf/distribution.hpp&gt;</a></li><li><ul class="section"><li><a href="distribution/overview.html"><strong>2.1.</strong> Distributions overview</a></li><li><a href="distribution/constructors.html"><strong>2.2.</strong> Constructors</a></li><li><a href="distribution/members.html"><strong>2.3.</strong> Class members</a></li><li><a href="distribution/functions.html"><strong>2.4.</strong> Non-member functions</a></li></ul></li><li><a href="random_digits.html"><strong>3.</strong> &lt;etf/random_digits.hpp&gt;</a></li><li><ul class="section"><li><a href="random_digits/integer_traits.html"><strong>3.1.</strong> Fixed-precision integer traits</a></li><li><a href="random_digits/random_numbers.html"><strong>3.2.</strong> Fixed-precision random numbers</a></li></ul></li><li><a href="util.html"><strong>4.</strong> &lt;etf/util.hpp&gt;</a></li><li><ul class="section"><li><a href="util/prepartitioning.html"><strong>4.1.</strong> Pre-partitoning</a></li><li><a href="util/partitioning.html"><strong>4.2.</strong> Partitioning</a></li><li><a href="util/outer_distributions.html"><strong>4.3.</strong> Outer distributions helper classes</a></li></ul></li><li><a href="license.html"><strong>5.</strong> License</a></li></ul>
51+
</div>
52+
53+
<div id="page-wrapper" class="page-wrapper">
54+
55+
<div class="page">
56+
<div id="menu-bar" class="menu-bar">
57+
<div class="left-buttons">
58+
<i id="sidebar-toggle" class="fa fa-bars"></i>
59+
<i id="theme-toggle" class="fa fa-paint-brush"></i>
60+
</div>
61+
62+
<h1 class="menu-title"></h1>
63+
64+
<div class="right-buttons">
65+
<i id="print-button" class="fa fa-print" title="Print this book"></i>
66+
</div>
67+
</div>
68+
69+
<div id="content" class="content">
70+
<h1>&lt;etf/distribution.hpp&gt;</h1>
71+
<p>The <code>&lt;etf/distribution.hpp&gt;</code> header provides the main distribution classes
72+
together with related convenience functions.</p>
73+
74+
</div>
75+
76+
<!-- Mobile navigation buttons -->
77+
78+
<a href="introduction.html" class="mobile-nav-chapters previous">
79+
<i class="fa fa-angle-left"></i>
80+
</a>
81+
82+
83+
84+
<a href="distribution/overview.html" class="mobile-nav-chapters next">
85+
<i class="fa fa-angle-right"></i>
86+
</a>
87+
88+
89+
</div>
90+
91+
92+
<a href="introduction.html" class="nav-chapters previous" title="You can navigate through the chapters using the arrow keys">
93+
<i class="fa fa-angle-left"></i>
94+
</a>
95+
96+
97+
98+
<a href="distribution/overview.html" class="nav-chapters next" title="You can navigate through the chapters using the arrow keys">
99+
<i class="fa fa-angle-right"></i>
100+
</a>
101+
102+
103+
</div>
104+
105+
106+
<!-- Local fallback for Font Awesome -->
107+
<script>
108+
if ($(".fa").css("font-family") !== "FontAwesome") {
109+
$('<link rel="stylesheet" type="text/css" href="_FontAwesome/css/font-awesome.css">').prependTo('head');
110+
}
111+
</script>
112+
113+
<!-- Livereload script (if served using the cli tool) -->
114+
115+
116+
<script src="highlight.js"></script>
117+
<script src="book.js"></script>
118+
</body>
119+
</html>

0 commit comments

Comments
 (0)