Document the purpose of most files

This commit is contained in:
dcodeIO
2018-03-17 23:41:48 +01:00
parent d45eb93df6
commit 5eb10d404f
30 changed files with 197 additions and 87 deletions

View File

@ -1,14 +1,7 @@
/*
Binaryen's C-API.
The WebAssembly version of the compiler will be linked against Binaryen
compiled to WebAssembly with these functions present in the binary while the
JS version calls them on the global object.
see: https://github.com/WebAssembly/binaryen/blob/master/src/binaryen-c.h
*/
/**
* @file TypeScript definitions for Binaryen's C-API.
* @see https://github.com/WebAssembly/binaryen/blob/master/src/binaryen-c.h
*/
declare function _malloc(size: usize): usize;
declare function _free(ptr: usize): void;

View File

@ -1,2 +1,6 @@
/**
* @file Definitions for linking Binaryen with AssemblyScript.
*/
declare function allocate_memory(size: usize): usize;
declare function free_memory(ptr: usize): void;

View File

@ -1,3 +1,7 @@
/**
* @file Glue code for linking Binaryen with AssemblyScript.
*/
// Copy Binaryen exports to global scope
const binaryen = global.Binaryen || require("binaryen");

View File

@ -1,3 +1,7 @@
/**
* @file I64 definitions for JavaScript.
*/
declare type I64 = { __Long__: true }; // opaque
declare function i64_new(lo: i32, hi?: i32): I64;

View File

@ -1,3 +1,8 @@
/**
* @file I64 implementation for JavaScript using long.js.
* @see https://github.com/dcodeIO/long.js
*/
const Long = global.Long || require("long");
global.i64_new = function(lo, hi) {

View File

@ -1,3 +1,7 @@
/**
* @file JavaScript glue code.
*/
import "../../../std/portable";
import "./binaryen";
import "./i64";

View File

@ -1,2 +1,6 @@
/**
* @file Definitions for running JavaScript under node.js.
*/
declare const global: any;
declare function require(name: string): any;

View File

@ -1,3 +1,7 @@
/**
* @file I64 wrapper for WebAssembly.
*/
type I64 = i64;
@global

View File

@ -1 +1,5 @@
/**
* @file WebAssembly glue code.
*/
import "./i64";