generated from valkyrie-language/valkyrie-compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0a820d3
Showing
13 changed files
with
438 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"parserOptions": { | ||
"project": "./tsconfig.json" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { WasiMathArithmeticF32 } from './interfaces/wasi-math-arithmetic-f32.js'; | ||
export { WasiMathArithmeticF64 } from './interfaces/wasi-math-arithmetic-f64.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export {WasiMathArithmeticF32} from './interfaces/wasi-math-arithmetic-f32.js'; | ||
export {WasiMathArithmeticF64} from './interfaces/wasi-math-arithmetic-f64.js'; | ||
|
||
let tryFindPort = false; | ||
let {port, host} = { | ||
port: 8000, | ||
host: 'localhost' | ||
}; | ||
if (port === undefined) { | ||
tryFindPort = true; | ||
port = '8000'; | ||
} | ||
import {HTTPServer} from '@bytecodealliance/preview2-shim/http'; | ||
|
||
const server = new HTTPServer(mod.incomingHandler); | ||
|
||
while (true) { | ||
try { | ||
server.listen(port, host); | ||
break; | ||
} catch (e) { | ||
if (e.code !== 'EADDRINUSE') | ||
throw e; | ||
} | ||
port++; | ||
} | ||
server.listen(port, host) | ||
|
||
process.stdout.write(`Server listening on \${port}...`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export namespace WasiMathArithmeticF32 { | ||
export function pow(base: number, exponent: number): number; | ||
export function cbrt(value: number): number; | ||
export function hypot(x: number, y: number): number; | ||
export function exp(value: number): number; | ||
export function expM1(value: number): number; | ||
export function log(base: number, value: number): number; | ||
export function ln(value: number): number; | ||
export function lnP1(value: number): number; | ||
export function log2(value: number): number; | ||
export function log10(value: number): number; | ||
export function cos(value: number): number; | ||
export function cosh(value: number): number; | ||
export function sin(value: number): number; | ||
export function sinh(value: number): number; | ||
export function tan(value: number): number; | ||
export function tanh(value: number): number; | ||
export function acos(value: number): number; | ||
export function acosh(value: number): number; | ||
export function asin(value: number): number; | ||
export function asinh(value: number): number; | ||
export function atan(value: number): number; | ||
export function atanh(value: number): number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
export const WasiMathArithmeticF32 = { | ||
pow: function (base, exponent) { | ||
return Math.pow(base, exponent); | ||
}, | ||
|
||
cbrt: function (value) { | ||
return Math.cbrt(value); | ||
}, | ||
|
||
hypot: function (x, y) { | ||
return Math.hypot(x, y); | ||
}, | ||
|
||
exp: function (value) { | ||
return Math.exp(value); | ||
}, | ||
|
||
expM1: function (value) { | ||
return Math.exp(value) - 1; | ||
}, | ||
|
||
log: function (base, value) { | ||
return Math.log(value) / Math.log(base); | ||
}, | ||
|
||
ln: function (value) { | ||
return Math.log(value); | ||
}, | ||
|
||
lnP1: function (value) { | ||
return Math.log(1 + value); | ||
}, | ||
|
||
log2: function (value) { | ||
return Math.log2(value); | ||
}, | ||
|
||
log10: function (value) { | ||
return Math.log10(value); | ||
}, | ||
|
||
cos: function (value) { | ||
return Math.cos(value); | ||
}, | ||
|
||
cosh: function (value) { | ||
return Math.cosh(value); | ||
}, | ||
|
||
sin: function (value) { | ||
return Math.sin(value); | ||
}, | ||
|
||
sinh: function (value) { | ||
return Math.sinh(value); | ||
}, | ||
|
||
tan: function (value) { | ||
return Math.tan(value); | ||
}, | ||
|
||
tanh: function (value) { | ||
return Math.tanh(value); | ||
}, | ||
|
||
acos: function (value) { | ||
return Math.acos(value); | ||
}, | ||
|
||
acosh: function (value) { | ||
return Math.acosh(value); | ||
}, | ||
|
||
asin: function (value) { | ||
return Math.asin(value); | ||
}, | ||
|
||
asinh: function (value) { | ||
return Math.asinh(value); | ||
}, | ||
|
||
atan: function (value) { | ||
return Math.atan(value); | ||
}, | ||
|
||
atanh: function (value) { | ||
return Math.atanh(value); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export namespace WasiMathArithmeticF64 { | ||
export function pow(base: number, exponent: number): number; | ||
export function cbrt(value: number): number; | ||
export function hypot(x: number, y: number): number; | ||
export function exp(value: number): number; | ||
export function expM1(value: number): number; | ||
export function log(base: number, value: number): number; | ||
export function ln(value: number): number; | ||
export function lnP1(value: number): number; | ||
export function log2(value: number): number; | ||
export function log10(value: number): number; | ||
export function cos(value: number): number; | ||
export function cosh(value: number): number; | ||
export function sin(value: number): number; | ||
export function sinh(value: number): number; | ||
export function tan(value: number): number; | ||
export function tanh(value: number): number; | ||
export function acos(value: number): number; | ||
export function acosh(value: number): number; | ||
export function asin(value: number): number; | ||
export function asinh(value: number): number; | ||
export function atan(value: number): number; | ||
export function atanh(value: number): number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
export const WasiMathArithmeticF64 = { | ||
pow: function (base, exponent) { | ||
return Math.pow(base, exponent); | ||
}, | ||
|
||
cbrt: function (value) { | ||
return Math.cbrt(value); | ||
}, | ||
|
||
hypot: function (x, y) { | ||
return Math.hypot(x, y); | ||
}, | ||
|
||
exp: function (value) { | ||
return Math.exp(value); | ||
}, | ||
|
||
expM1: function (value) { | ||
return Math.exp(value) - 1; | ||
}, | ||
|
||
log: function (base, value) { | ||
return Math.log(value) / Math.log(base); | ||
}, | ||
|
||
ln: function (value) { | ||
return Math.log(value); | ||
}, | ||
|
||
lnP1: function (value) { | ||
return Math.log(1 + value); | ||
}, | ||
|
||
log2: function (value) { | ||
return Math.log2(value); | ||
}, | ||
|
||
log10: function (value) { | ||
return Math.log10(value); | ||
}, | ||
|
||
cos: function (value) { | ||
return Math.cos(value); | ||
}, | ||
|
||
cosh: function (value) { | ||
return Math.cosh(value); | ||
}, | ||
|
||
sin: function (value) { | ||
return Math.sin(value); | ||
}, | ||
|
||
sinh: function (value) { | ||
return Math.sinh(value); | ||
}, | ||
|
||
tan: function (value) { | ||
return Math.tan(value); | ||
}, | ||
|
||
tanh: function (value) { | ||
return Math.tanh(value); | ||
}, | ||
|
||
acos: function (value) { | ||
return Math.acos(value); | ||
}, | ||
|
||
acosh: function (value) { | ||
return Math.acosh(value); | ||
}, | ||
|
||
asin: function (value) { | ||
return Math.asin(value); | ||
}, | ||
|
||
asinh: function (value) { | ||
return Math.asinh(value); | ||
}, | ||
|
||
atan: function (value) { | ||
return Math.atan(value); | ||
}, | ||
|
||
atanh: function (value) { | ||
return Math.atanh(value); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "@valkyrie-language/math-shim", | ||
"version": "0.0.0", | ||
"description": "Valkyrie language math library for js platform", | ||
"license": "MIT", | ||
"type": "module", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"typings": "index.d.ts", | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
"scripts": { | ||
"build": "jco transpile wit --stub -o . --name index", | ||
"lint": "eslint 'interfaces/*.{js,ts,tsx}'" | ||
}, | ||
"dependencies": { | ||
|
||
} | ||
} |
Empty file.
Oops, something went wrong.