annotate modules/os.tp @ 372:e857104bd183

Added reverse method to arrays
author Michael Pavone <pavone@retrodev.com>
date Wed, 12 Aug 2015 19:16:41 -0700
parents f987bb2a1911
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
294
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 _constant <- macro: :name {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3 quote: (llMessage: name withVars: {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 uintret <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
5 } andCode: {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6 uintret <- make_object: (addr_of: obj_int32_meta) NULL 0
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
7 uintret num!: name
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8 uintret
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
9 })
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
10 }
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
11 #{
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12 includeSystemHeader: "sys/stat.h"
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13 includeSystemHeader: "fcntl.h"
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14 includeSystemHeader: "stdlib.h"
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
15 includeSystemHeader: "time.h"
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16 includeSystemHeader: "unistd.h"
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
18 llMessage: write withVars: {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
19 str <- string ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
20 intret <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
21 filedes <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
22 } andCode: :filedes str {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
23 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
24 intret num!: (write: (filedes num) (str data) (str bytes))
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
25 intret
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
26 }
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
27
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
28 llMessage: read withVars: {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
29 str <- string ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
30 size <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
31 filedes <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
32 } andCode: :filedes size {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
33 str <- make_object: (addr_of: string_meta) NULL 0
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
34 str data!: (GC_MALLOC_ATOMIC: (size num) + 1)
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
35 str bytes!: (read: (filedes num) (str data) (size num))
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
36 if: (str bytes) < 0 {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
37 str bytes!: 0
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
38 }
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
39 str len!: (str bytes)
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
40 (str data) set: (str bytes) 0
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
41 str
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
42 }
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
43
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
44 llMessage: readFrom:to withVars: {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
45 buffer <- object ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
46 bufOpaque <- cpointer ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
47 size <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
48 filedes <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
49 intret <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
50 } andCode: :filedes buffer {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
51 bufOpaque <- (mcall: _buf_ptr 1 buffer) castTo: (cpointer ptr)
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
52 size <- (mcall: length 1 buffer) castTo: (obj_int32 ptr)
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
53 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
54 intret num!: (read: (filedes num) (bufOpaque val) (size num))
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
55 intret
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
56 }
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
57
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
58 open <- :filename flags {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
59 open: filename flags createPerm: 0b110110110
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
60 }
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
61
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
62 llMessage: open:createPerm withVars: {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
63 filename <- string ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
64 flags <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
65 perm <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
66 filedes <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
67 } andCode: :filename flags :perm {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
68 filedes <- make_object: (addr_of: obj_int32_meta) NULL 0
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
69 filedes num!: (open: (filename data) (flags num) (perm num))
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
70 filedes
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
71 }
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
72
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
73 llMessage: close withVars: {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
74 filedes <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
75 intret <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
76 } andCode: :filedes {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
77 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
78 intret num!: (close: (filedes num))
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
79 intret
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
80 }
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
81
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
82 _constant: O_RDONLY
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
83 _constant: O_WRONLY
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
84 _constant: O_RDWR
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
85 _constant: O_CREAT
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
86 _constant: O_APPEND
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
87 _constant: O_TRUNC
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
88
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
89 llMessage: rand withVars: {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
90 intret <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
91 } andCode: {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
92 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
93 intret num!: (rand: )
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
94 intret
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
95 }
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
96
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
97 llMessage: srand withVars: {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
98 oseed <- object ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
99 seed <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
100 } andCode: :oseed {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
101 seed <- (mcall: i32 1 oseed) castTo: (obj_int32 ptr)
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
102 srand: (seed num)
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
103 seed
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
104 }
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
105
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
106 llMessage: time withVars: {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
107 intret64 <- obj_int64 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
108 } andCode: {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
109 intret64 <- make_object: (addr_of: obj_int64_meta) NULL 0
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
110 intret64 num!: (time: NULL)
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
111 intret64
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
112 }
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
113
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
114 llMessage: sleep withVars: {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
115 osecs <- object ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
116 secs <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
117 intret <- obj_int32 ptr
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
118 } andCode: :osecs {
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
119 secs <- (mcall: i32 1 osecs) castTo: (obj_int32 ptr)
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
120 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
121 intret num!: (sleep: (secs num))
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
122 intret
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
123 }
315
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
124
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
125 llMessage: execv withVars: {
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
126 opath <- object ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
127 path <- string ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
128 eargs <- object ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
129 oarglen <- object ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
130 arglen <- obj_int32 ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
131 i <- int32_t
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
132 oi <- obj_int32 ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
133 oarg <- object ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
134 arg <- string ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
135 cargs <- (char ptr) ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
136 } andCode: :opath eargs {
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
137 path <- (mcall: string 1 opath) castTo: (string ptr)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
138 oarglen <- mcall: length 1 eargs
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
139 arglen <- (mcall: int32 1 oarglen) castTo: (obj_int32 ptr)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
140 cargs <- GC_MALLOC_ATOMIC: (sizeof: (char ptr)) * ((arglen num) + 1)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
141 i <- 0
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
142 while: { i < (arglen num) } do: {
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
143 oi <- make_object: (addr_of: obj_int32_meta) NULL 0
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
144 oi num!: i
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
145 oarg <- mcall: get 2 eargs oi
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
146 arg <- (mcall: string 1 oarg) castTo: (string ptr)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
147 cargs set: i (arg data)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
148 i <- i + 1
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
149 }
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
150 cargs set: i NULL
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
151 i <- execv: (path data) cargs
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
152 oi <- make_object: (addr_of: obj_int32_meta) NULL 0
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
153 oi num!: i
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
154 oi
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
155 }
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
156
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
157 llMessage: execvp withVars: {
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
158 opath <- object ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
159 path <- string ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
160 eargs <- object ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
161 oarglen <- object ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
162 arglen <- obj_int32 ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
163 i <- int32_t
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
164 oi <- obj_int32 ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
165 oarg <- object ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
166 arg <- string ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
167 cargs <- (char ptr) ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
168 } andCode: :opath eargs {
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
169 path <- (mcall: string 1 opath) castTo: (string ptr)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
170 oarglen <- mcall: length 1 eargs
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
171 arglen <- (mcall: int32 1 oarglen) castTo: (obj_int32 ptr)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
172 cargs <- GC_MALLOC_ATOMIC: (sizeof: (char ptr)) * ((arglen num) + 1)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
173 i <- 0
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
174 while: { i < (arglen num) } do: {
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
175 oi <- make_object: (addr_of: obj_int32_meta) NULL 0
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
176 oi num!: i
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
177 oarg <- mcall: get 2 eargs oi
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
178 arg <- (mcall: string 1 oarg) castTo: (string ptr)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
179 cargs set: i (arg data)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
180 i <- i + 1
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
181 }
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
182 cargs set: i NULL
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
183 i <- execvp: (path data) cargs
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
184 oi <- make_object: (addr_of: obj_int32_meta) NULL 0
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
185 oi num!: i
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
186 oi
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
187 }
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
188
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
189 llMessage: execve withVars: {
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
190 opath <- object ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
191 path <- string ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
192 eargs <- object ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
193 env <- object ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
194 oarglen <- object ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
195 arglen <- obj_int32 ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
196 i <- int32_t
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
197 oi <- obj_int32 ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
198 oarg <- object ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
199 arg <- string ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
200 cargs <- (char ptr) ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
201 cenv <- (char ptr) ptr
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
202 } andCode: :opath eargs env {
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
203 path <- (mcall: string 1 opath) castTo: (string ptr)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
204 oarglen <- mcall: length 1 eargs
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
205 arglen <- (mcall: int32 1 oarglen) castTo: (obj_int32 ptr)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
206 cargs <- GC_MALLOC_ATOMIC: (sizeof: (char ptr)) * ((arglen num) + 1)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
207 i <- 0
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
208 while: { i < (arglen num) } do: {
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
209 oi <- make_object: (addr_of: obj_int32_meta) NULL 0
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
210 oi num!: i
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
211 oarg <- mcall: get 2 eargs oi
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
212 arg <- (mcall: string 1 oarg) castTo: (string ptr)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
213 cargs set: i (arg data)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
214 i <- i + 1
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
215 }
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
216 cargs set: i NULL
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
217
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
218 oarglen <- mcall: length 1 eargs
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
219 arglen <- (mcall: int32 1 oarglen) castTo: (obj_int32 ptr)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
220 cenv <- GC_MALLOC_ATOMIC: (sizeof: (char ptr)) * ((arglen num) + 1)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
221 i <- 0
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
222 while: { i < (arglen num) } do: {
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
223 oi <- make_object: (addr_of: obj_int32_meta) NULL 0
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
224 oi num!: i
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
225 oarg <- mcall: get 2 env oi
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
226 arg <- (mcall: string 1 oarg) castTo: (string ptr)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
227 cenv set: i (arg data)
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
228 i <- i + 1
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
229 }
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
230 cenv set: i NULL
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
231
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
232 i <- execve: (path data) cargs cenv
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
233 oi <- make_object: (addr_of: obj_int32_meta) NULL 0
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
234 oi num!: i
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
235 oi
f987bb2a1911 WIP native compiler work
Michael Pavone <pavone@retrodev.com>
parents: 294
diff changeset
236 }
294
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
237 }
d1dc2d70bdfd Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
238 }