aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/vlib/builtin/linux_bare/old/builtin_bare.v
diff options
context:
space:
mode:
authorIndrajith K L2022-12-03 17:00:20 +0530
committerIndrajith K L2022-12-03 17:00:20 +0530
commitf5c4671bfbad96bf346bd7e9a21fc4317b4959df (patch)
tree2764fc62da58f2ba8da7ed341643fc359873142f /v_windows/v/vlib/builtin/linux_bare/old/builtin_bare.v
downloadcli-tools-windows-master.tar.gz
cli-tools-windows-master.tar.bz2
cli-tools-windows-master.zip
Adds most of the toolsHEADmaster
Diffstat (limited to 'v_windows/v/vlib/builtin/linux_bare/old/builtin_bare.v')
-rw-r--r--v_windows/v/vlib/builtin/linux_bare/old/builtin_bare.v60
1 files changed, 60 insertions, 0 deletions
diff --git a/v_windows/v/vlib/builtin/linux_bare/old/builtin_bare.v b/v_windows/v/vlib/builtin/linux_bare/old/builtin_bare.v
new file mode 100644
index 0000000..a7be853
--- /dev/null
+++ b/v_windows/v/vlib/builtin/linux_bare/old/builtin_bare.v
@@ -0,0 +1,60 @@
+module builtin
+
+// called by the generated main/init
+fn init() {
+}
+
+pub fn isnil(p voidptr) bool {
+ return p == 0
+}
+
+pub fn print(s string) {
+ sys_write(1, s.str, u64(s.len))
+}
+
+pub fn println(s string) {
+ print(s)
+ print('\n')
+}
+
+pub fn panic(s string) {
+ eprint('V panic: ')
+ eprintln(s)
+ sys_exit(1)
+}
+
+// replaces panic when -debug arg is passed
+fn panic_debug(line_no int, file string, mod string, fn_name string, s string) {
+ eprintln('================ V panic ================')
+ eprint(' module: ')
+ eprintln('mod')
+ eprint(' function: ')
+ eprint(fn_name)
+ eprintln('()')
+ eprintln(' file: ')
+ eprintln(file)
+ // println(' line: ${line_no}')
+ eprint(' message: ')
+ eprintln(s)
+ eprintln('=========================================')
+ sys_exit(1)
+}
+
+pub fn eprint(s string) {
+ if isnil(s.str) {
+ panic('eprint(NIL)')
+ }
+ sys_write(2, s.str, u64(s.len))
+}
+
+pub fn eprint_ln(s string) {
+ eprint(s)
+ eprint('\n')
+}
+
+pub fn eprintln(s string) {
+ if isnil(s.str) {
+ panic('eprintln(NIL)')
+ }
+ eprint_ln(s)
+}