diff options
author | EuAndreh <eu@euandre.org> | 2020-02-24 02:27:40 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-02-24 02:27:40 -0300 |
commit | e8d9017938cd020bcf62c359da0a531c984239b2 (patch) | |
tree | 6c17cdb6f65b2cb27d5ddb3e7e96c3b724804519 | |
parent | Move draft posts to _drafts (diff) | |
download | euandre.org-e8d9017938cd020bcf62c359da0a531c984239b2.tar.gz euandre.org-e8d9017938cd020bcf62c359da0a531c984239b2.tar.xz |
Remove tmp/
-rw-r--r-- | tmp/add.c | 13 | ||||
-rw-r--r-- | tmp/add.h | 3 | ||||
-rw-r--r-- | tmp/api-posix.c | 15 | ||||
-rw-r--r-- | tmp/api-wasm.js | 7 | ||||
-rw-r--r-- | tmp/api.h | 2 | ||||
-rw-r--r-- | tmp/index.html | 14 | ||||
-rw-r--r-- | tmp/main.c | 12 | ||||
-rw-r--r-- | tmp/main.js | 1 | ||||
-rwxr-xr-x | tmp/server.py | 15 |
9 files changed, 0 insertions, 82 deletions
diff --git a/tmp/add.c b/tmp/add.c deleted file mode 100644 index 99267ed..0000000 --- a/tmp/add.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "api.h" - -int add(int a, int b) { - return a * a + b; -} - -void persistInt(int n) { - platformDependentPersistInt(n); -} - -int retrieveInt() { - return platformDependentRetrieveInt(); -} diff --git a/tmp/add.h b/tmp/add.h deleted file mode 100644 index 54c0712..0000000 --- a/tmp/add.h +++ /dev/null @@ -1,3 +0,0 @@ -int add(int a, int b); -void persistInt(int n); -int retrieveInt(); diff --git a/tmp/api-posix.c b/tmp/api-posix.c deleted file mode 100644 index 9f51967..0000000 --- a/tmp/api-posix.c +++ /dev/null @@ -1,15 +0,0 @@ -/* POSIX implementation of "api.h" interface to be used in non-web contexts */ - -#include <stdio.h> - -void platformDependentPersistInt(int n) { - FILE* fp = fopen("/tmp/persisted.txt", "w+"); - fprintf(fp, "%d", n); - fclose(fp); -} - -int platformDependentRetrieveInt() { - FILE* fp = fopen("/tmp/persisted.txt", "r"); - int persisted = fgetc(fp); - return persisted; -} diff --git a/tmp/api-wasm.js b/tmp/api-wasm.js deleted file mode 100644 index 50e1392..0000000 --- a/tmp/api-wasm.js +++ /dev/null @@ -1,7 +0,0 @@ -/* WASM implementation of "api.h" interface to be used in web contexts */ - -export const platformDependentPersistInt = (n) => - localStorage.setItem("persisted", n.toString()); - -export const platformDependentRetrieveInt = () => - parseInt(localStorage.getItem("persisted")); diff --git a/tmp/api.h b/tmp/api.h deleted file mode 100644 index 9b8d27d..0000000 --- a/tmp/api.h +++ /dev/null @@ -1,2 +0,0 @@ -extern void platformDependentPersistInt(int); -extern int platformDependentRetrieveInt(); diff --git a/tmp/index.html b/tmp/index.html deleted file mode 100644 index b222149..0000000 --- a/tmp/index.html +++ /dev/null @@ -1,14 +0,0 @@ -<script type="module"> - import * as api from "./api-wasm.js"; - - WebAssembly - .instantiateStreaming(fetch("add.wasm"), { env: api }) - .then(({instance: {exports}}) => { - const added = exports.add(4, 5); - console.log("Adding 4 and 5:", added); - - exports.persistInt(6); - const persisted = exports.retrieveInt(); - console.log("Persisted number:", persisted); - }); -</script> diff --git a/tmp/main.c b/tmp/main.c deleted file mode 100644 index 0ae18f7..0000000 --- a/tmp/main.c +++ /dev/null @@ -1,12 +0,0 @@ -#include <stdio.h> -#include "add.h" - -int main() { - int added = add(4, 5); - printf("Adding 4 and 5: %d\n", added); - - persistInt(6); - int persisted = retrieveInt(); - printf("Persisted number: %c\n", persisted); - return 0; -} diff --git a/tmp/main.js b/tmp/main.js deleted file mode 100644 index 3c105b2..0000000 --- a/tmp/main.js +++ /dev/null @@ -1 +0,0 @@ -import * as wasm from './' diff --git a/tmp/server.py b/tmp/server.py deleted file mode 100755 index a76c833..0000000 --- a/tmp/server.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python -import SimpleHTTPServer -import SocketServer - -PORT = 8001 - -class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler): - pass - -Handler.extensions_map['.wasm'] = 'application/wasm' - -httpd = SocketServer.TCPServer(("", PORT), Handler) - -print "serving at port", PORT -httpd.serve_forever() |