-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
2 changed files
with
40 additions
and
40 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 |
---|---|---|
@@ -1,81 +1,81 @@ | ||
@Intrinsic("argc") | ||
@intrinsic("argc") | ||
pub func argc(): Int | ||
|
||
@Intrinsic("argv") | ||
@intrinsic("argv") | ||
pub func argv(): Pointer<Pointer<Byte>> | ||
|
||
@Intrinsic("__callstack") | ||
@intrinsic("__callstack") | ||
pub func callstack(): Pointer<Int> | ||
|
||
@Intrinsic("__callstackp") | ||
@intrinsic("__callstackp") | ||
pub func callstackPtr(): Int | ||
|
||
@Intrinsic("modulenames") | ||
@intrinsic("modulenames") | ||
pub func moduleNames(): Pointer<Byte> | ||
|
||
@Intrinsic("functionnames") | ||
@intrinsic("functionnames") | ||
pub func functionNames(): Pointer<Byte> | ||
|
||
@Intrinsic("uninitialized") | ||
@intrinsic("uninitialized") | ||
pub func uninitialized<T>(): T | ||
|
||
@Intrinsic("u64_to_string") | ||
@intrinsic("u64_to_string") | ||
pub func u64ToString(i: Int): String | ||
|
||
@Intrinsic("int_as_char") | ||
@intrinsic("int_as_char") | ||
pub func intAsChar(i: Int): Char | ||
|
||
@Intrinsic("char_as_int") | ||
@intrinsic("char_as_int") | ||
pub func charAsInt(c: Char): Int | ||
|
||
@Intrinsic("int_as_float") | ||
@intrinsic("int_as_float") | ||
pub func intAsFloat(i: Int): Float | ||
|
||
@Intrinsic("float_as_int") | ||
@intrinsic("float_as_int") | ||
pub func floatAsInt(f: Float): Int | ||
|
||
@Intrinsic("float_floor") | ||
@intrinsic("float_floor") | ||
pub func floor(f: Float): Int | ||
|
||
@Intrinsic("float_ceil") | ||
@intrinsic("float_ceil") | ||
pub func ceil(f: Float): Int | ||
|
||
@Intrinsic("float_round") | ||
@intrinsic("float_round") | ||
pub func round(f: Float): Int | ||
|
||
pub type Byte { | ||
@Intrinsic("byte_from_int") | ||
@intrinsic("byte_from_int") | ||
pub func fromInt(value: Int): Byte | ||
|
||
@Intrinsic("byte_as_int") | ||
@intrinsic("byte_as_int") | ||
pub func asInt(self): Int | ||
} | ||
|
||
pub type Pointer<T> { | ||
@Intrinsic("pointer_null") | ||
@intrinsic("pointer_null") | ||
pub func null<T>(): Pointer<T> | ||
|
||
@Intrinsic("pointer_is_null") | ||
@intrinsic("pointer_is_null") | ||
pub func isNullPtr(self): Bool | ||
|
||
@Intrinsic("pointer_malloc") | ||
@intrinsic("pointer_malloc") | ||
pub func malloc<T>(count = 1): Pointer<T> | ||
|
||
@Intrinsic("pointer_realloc") | ||
@intrinsic("pointer_realloc") | ||
pub func realloc<T>(ptr: Pointer<T>, count: Int): Pointer<T> | ||
|
||
@Intrinsic("pointer_address") | ||
@intrinsic("pointer_address") | ||
pub func address(self): Int | ||
|
||
@Intrinsic("pointer_store") | ||
@intrinsic("pointer_store") | ||
pub func store(self, value: T) | ||
|
||
@Intrinsic("pointer_load") | ||
@intrinsic("pointer_load") | ||
pub func load(self): T | ||
|
||
@Intrinsic("pointer_offset") | ||
@intrinsic("pointer_offset") | ||
pub func offset(self, offset: Int): Pointer<T> | ||
|
||
@Intrinsic("pointer_copy_from") | ||
@intrinsic("pointer_copy_from") | ||
pub func copyFrom(self, other: Pointer<T>, size: Int) | ||
} |
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 |
---|---|---|
@@ -1,58 +1,58 @@ | ||
import Pointer, Byte from "./_intrinsics" | ||
|
||
@CBinding("getenv") | ||
@external("getenv") | ||
pub func getenv(name: Pointer<Byte>): Pointer<Byte> | ||
|
||
@Intrinsic("errno") | ||
@intrinsic("errno") | ||
pub func errno(): Int | ||
|
||
@CBinding("strerror") | ||
@external("strerror") | ||
pub func strerror(errno: Int): Pointer<Byte> | ||
|
||
pub val O_RDONLY = 0 | ||
pub val O_WRONLY = 1 | ||
pub val O_RDWR = 2 | ||
pub val O_CREAT = 512 | ||
|
||
@CBinding("open") | ||
@external("open") | ||
pub func open(pathname: Pointer<Byte>, flags: Int, mode: Int): Int | ||
|
||
@CBinding("close") | ||
@external("close") | ||
pub func close(fd: Int): Int | ||
|
||
pub val SEEK_SET = 0 | ||
pub val SEEK_CUR = 1 | ||
pub val SEEK_END = 2 | ||
|
||
@CBinding("lseek") | ||
@external("lseek") | ||
pub func lseek(fd: Int, offset: Int, whence: Int): Int | ||
|
||
@CBinding("read") | ||
@external("read") | ||
pub func read(fd: Int, buf: Pointer<Byte>, count: Int): Int | ||
|
||
@CBinding("stat") | ||
@external("stat") | ||
pub func stat(pathname: Pointer<Byte>, statbuf: Pointer<Byte>): Int | ||
|
||
pub val STDIN_FILENO = 0 | ||
pub val STDOUT_FILENO = 1 | ||
pub val STDERR_FILENO = 2 | ||
|
||
@CBinding("write") | ||
@external("write") | ||
pub func write(fd: Int, buf: Pointer<Byte>, count: Int): Int | ||
|
||
pub val PATH_MAX = 4096 | ||
|
||
@CBinding("getcwd") | ||
@external("getcwd") | ||
pub func getcwd(buf: Pointer<Byte>, count: Int): Pointer<Byte> | ||
|
||
@CBinding("strlen") | ||
@external("strlen") | ||
pub func strlen(s: Pointer<Byte>): Int | ||
|
||
@CBinding("uname") | ||
@external("uname") | ||
pub func uname(utsnameBuf: Pointer<Byte>): Int | ||
|
||
@CBinding("rand") | ||
@external("rand") | ||
pub func rand(): Int | ||
|
||
@CBinding("exit") | ||
@external("exit") | ||
pub func exit(status: Int): Unit |