Skip to content

Commit

Permalink
https://wasp.pannous.com/ points to GITHUB page!!
Browse files Browse the repository at this point in the history
CURRENT TESTS PASSED
  • Loading branch information
pannous committed Sep 12, 2024
1 parent 17c4e0e commit 492a8df
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
3 changes: 1 addition & 2 deletions docs/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ let exampleCode = {
alert: 'script: alert("Hello, World!")',
javascript: `html: div id="app"; app.innerHTML = "Hello, World!"`,
draw_sine: `// sine wave\nfor i in 0..1000\n ctx.lineTo(i, 100 + Math.sin(i / 10) * 50)\nctx.stroke()`,
sine: `
double sin(double x){
sine: `double sin(double x){
double
S1 = -1.66666666666666324348e-01,
S2 = 8.33333333332248946124e-03,
Expand Down
17 changes: 12 additions & 5 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
overflow: auto;
min-height: 100px; /* Minimum height for the editor */
min-width: 200px; /* Minimum width for the editor */
border: 1px solid #ddd;
}
</style>
<!-- <link href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/addon/hint/show-hint.min.css" rel="stylesheet">-->
Expand Down Expand Up @@ -67,10 +68,13 @@
<!--<body style="background: cornsilk">-->
<!--<body style="background: aliceblue">-->
<!--<body style="background: azure">-->

<a href="https://github.com/pannous/wasp/" style="position: absolute; top: 20px; right: 20px;" target="_blank">
<img alt="GitHub Logo" height="60" src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
style="box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.5); border-radius: 8px;" width="60">
</a>
<div>
<h1>🐝 <a href="https://github.com/pannous/wasp">Wasp</a></h1>
<h2>A new programming language for wasm</h2>
<h2>A new programming language for Wasm</h2>
<label for="examples">Choose a Wasp example:</label>
<select id="examples"
onchange="results.value='';editor.setValue(exampleCode[value]);compile_and_run(editor.getValue())">
Expand All @@ -85,11 +89,14 @@ <h2>A new programming language for wasm</h2>
<br/>
<textarea id="code" onkeyup="compile_and_run(editor.getValue())">√3^2</textarea>
<br/>
<input id="input_file" onchange="readFile()" type="file"/>
<!-- <input id="input_file" onchange="readFile()" type="file"/>-->
<input checked id="check" type="checkbox"/> auto
<button onclick="compile_and_run(editor.getValue())">RUN!</button>
<button onclick="results.value=''">CLEAR</button>
<button onclick="download_file(editor.getValue(), 'source.wasp', 'wasp')" title="download wasp">💾 wasp</button>
<button onclick="download_file(wasm_buffer, 'emit.wasm', 'wasm')" title="download wasm">💾 wasm</button>
<!-- spacer -->
<div style="width: 250px;display: inline-block; "></div>
<button onclick="download_file(editor.getValue(), 'source.wasp', 'wasp')" title="download wasp">💾 source.wasp</button>
<button onclick="download_file(wasm_buffer, 'compiled.wasm', 'wasm')" title="download wasm">💾 compiled.wasm</button>
<br/>
<textarea cols="80" id="results" placeholder="RESULT… press run to compile" rows="8">
</textarea>
Expand Down
2 changes: 1 addition & 1 deletion docs/wasp.js
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ async function run_wasm(buf_pointer, buf_size) {
if (needs_runtime) {
app = await WebAssembly.instantiate(wasm_buffer, imports, memory) // todo: tweaked imports if it calls out
// app = await WebAssembly.instantiate(wasm_buffer, runtime_imports, runtime_instance.memory) // todo: tweaked imports if it calls out
print("app loaded")
print("compiled wasm app/script loaded")
} else {
let memory2 = new WebAssembly.Memory({initial: 10, maximum: 65536});// pages à 2^16 = 65536 bytes
app = await WebAssembly.instantiate(wasm_buffer, imports, memory2) // todo: tweaked imports if it calls out
Expand Down
13 changes: 13 additions & 0 deletions source/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@
//void testDwarf();
//void testSourceMap();

void testInclude() {
// assert_emit("include test-include.wasp", 42);
// assert_emit("use test-include.wasm", 42);
assert_emit("include test/lib.wasp", 42);
// assert_emit("include test/lib.wast", 42);
assert_emit("use test/lib.wasm; test", 42);
// assert_emit("use https://pannous.com/files/lib.wasm; test", 42);
// assert_emit("use git://pannous/waps/test/lib.wasm; test", 42);
// assert_emit("use system:test/lib.wasm; test", 42); // ^^

}

void testExceptions() {
// assert_emit("(unclosed bracket",123);

Expand Down Expand Up @@ -3405,6 +3417,7 @@ void pleaseFix() {
// 2022-12-28 : 3 sec WITH runtime_emit, wasmedge on M1 WOW ALL TESTS PASSING
// ⚠️ CANNOT USE assert_emit in WASM! ONLY via void testRun();
void testCurrent() {
testInclude();
// check_is("τ≈6.2831853",true);
// assert_emit("τ≈6.2831853",1);
testExceptions();
Expand Down

0 comments on commit 492a8df

Please sign in to comment.