Mercurial > repos > tabletprog
annotate modules/os.tp @ 304:dcb495cf2b97
Add fd method to file objects for accessing file descriptor
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 26 Jul 2014 15:01:38 -0700 |
parents | d1dc2d70bdfd |
children | f987bb2a1911 |
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 } |
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
|
124 } |
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
|
125 } |