diff options
Diffstat (limited to 'source/common.elna')
| -rw-r--r-- | source/common.elna | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/source/common.elna b/source/common.elna index e7b30ca..33a79b8 100644 --- a/source/common.elna +++ b/source/common.elna @@ -1,50 +1,50 @@ (* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. *) -module; -import cstring, cstdio; +import cstring, cstdio type - Identifier = [256]Char; + Identifier = [256]Char TextLocation* = record line: Word; column: Word - end; + end -proc write*(fd: Int, buf: Pointer, Word: Int) -> Int; extern; +proc write*(fd: Int, buf: Pointer, Word: Int) -> Int +extern -proc write_s*(value: String); +proc write_s*(value: String) begin (* fwrite(cast(value.ptr: Pointer), value.length, 1u, stdout) *) write(1, cast(value.ptr: Pointer), cast(value.length: Int)) -end; +end -proc write_z*(value: ^Char); +proc write_z*(value: ^Char) begin write(1, cast(value: Pointer), cast(strlen(value): Int)) -end; +end -proc write_b*(value: Bool); +proc write_b*(value: Bool) begin if value then write_s("true") else write_s("false") end -end; +end -proc write_c*(value: Char); +proc write_c*(value: Char) begin putchar(cast(value: Int)); fflush(nil) -end; +end -proc write_i*(value: Int); +proc write_i*(value: Int) var - digit: Int; - n: Word; - buffer: [10]Char; + digit: Int + n: Word + buffer: [10]Char begin n := 10u; @@ -62,11 +62,11 @@ begin n := n + 1u; write_c(buffer[n]) end -end; +end -proc write_u*(value: Word); +proc write_u*(value: Word) begin write_i(cast(value: Int)) -end; +end end. |
