-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
124 lines (99 loc) · 3.61 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!doctype html>
<html>
<head>
<meta charset=utf-8/>
<style type="text/css">
body {
padding: 0 1em 0 1em;
font-family: helvetica;
font-family: Verdana,Arial,'Lucida Grande',Sans-Serif;
}
.title { margin-bottom: 1em; }
.right { float: right; }
.clear { clear: both; }
.text-center { text-align: center; }
.intro { margin: auto; text-align: justify;
margin-top: 1.5em;
font-size: 1.5em;
}
.intro code { line-height: normal; }
.top-img { text-align: center; }
.section_anchor { display: none; margin-left: 0.5em; }
h3:hover .section_anchor { display: initial; }
.hidden { display: none; }
.small_img { max-width: 6em; margin: 0.5em; }
.code_cont {
float: left;
position: relative;
width: calc( 100% - 2em );
padding: 1em;
}
@media screen and (max-width: 999px) {
.right, pre, button, .code_cont_header { font-size: 1.8em; }
.code_cont {font-size: 1.5em; }
pre button { font-size: 1.2em; }
#speedtest_output { font-size: 0.85em; }
h3 { margin-top: 3em; }
}
@media screen and (min-width: 1200px) {
.intro { max-width: 600px;
line-height: 1.2em;
}
.code_cont {
width: calc( 50% - 2em );
}
}
.code_cont_header {
margin-top: 2em;
background-color: lightgrey;
border: solid 1px black;
padding: 1em;
}
.code_o { width: 100%; margin: 0; max-height: 100%; }
.code_o.fext_unittest_js { height: 65em; }
.code_o.fext_js { height: 435em; }
.success { color: darkgreen; }
.failure { color: darkred; font-weight: bold;}
.speedtest_patience { display: none; }
.speedtest_running .speedtest_patience { display: inherit; }
.speedtest_running button { display: none; }
</style>
<script type="text/javascript" src="ct.js"></script>
<script type="text/javascript" src="expl.js"></script>
</head>
<body>
<script type="text/javascript">function href( s ) { document.write( '\x3Ca href="'+s+'"\x3E'+s+'\x3C/a\x3E' ); }</script>
<div class="intro">
<pre><code><a href="https://github.com/glathoud/ct.js">ct.js</a>: Compile Time Function Execution (CTFE) in JavaScript
Inspired from the CTFE of the D language, ct.js permits to
generate efficient code while maintaining expressiveness.
By <a href="..">G. Lathoud</a>, December 2019 and later. Contact: [email protected]
The Boost license apply, as described in the file <script type="text/javascript">href('./LICENSE')</script>
</code></pre>
<hr/>
<p>Open your Developer Tools & JS console to see the examples in action.
<h3>Sources</h3>
<p>The sources for <code>expl.js</code> and <code>ct.js</code> are displayed below. For fun, I used <code>ct.js</code> to dump and prettify the two source files:</p>
<pre><code class="prettyprint lang-js">ct( () => {
ct.def( one, (s) =>
`write_source_code(${s}_source_code,"${s}.js")` ).ct;
ct.one("expl").ct;
ct.one("ct").ct;
})();</code></pre>
</div>
<hr/>
<div id="expl_source_code" class="code_cont"></div>
<div id="ct_source_code" class="code_cont"></div>
<link rel="stylesheet" type="text/css" href="web/prettify.css">
<script type="text/javascript" src="web/prettify.js"></script>
<script type="text/javascript" src="web/write_source_code.js"></script>
<script type="text/javascript">
ct( () => {
ct.def( one, (s) =>
`write_source_code(${s}_source_code,"${s}.js")` ).ct;
ct.one("expl").ct;
ct.one("ct").ct;
})();
</script>
</body>
</html>