Mercurial > repos > tabletprog
annotate samples/osmod.tp @ 354:a6cdcc1b1c02
Fix il and llcompile modules enough that it actually attempts to run the compiled program
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 15 Apr 2015 20:08:38 -0700 |
parents | d1dc2d70bdfd |
children |
rev | line source |
---|---|
48
18ab96287c3a
Add builtin module os containing some baisc POSIX file IO
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #{ |
18ab96287c3a
Add builtin module os containing some baisc POSIX file IO
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 main <- { |
18ab96287c3a
Add builtin module os containing some baisc POSIX file IO
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 os write: 1 "hello stdout via POSIX write\n" |
18ab96287c3a
Add builtin module os containing some baisc POSIX file IO
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 name <- os read: 0 100 |
18ab96287c3a
Add builtin module os containing some baisc POSIX file IO
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 os write: 2 "hello " . name . " via stderr\n" |
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:
49
diff
changeset
|
6 file <- os open: "output.txt" (os O_WRONLY) + (os O_CREAT) + (os O_TRUNC) createPerm: 0b110110110 |
48
18ab96287c3a
Add builtin module os containing some baisc POSIX file IO
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 os write: file "hello file!\n" |
18ab96287c3a
Add builtin module os containing some baisc POSIX file IO
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 os close: file |
18ab96287c3a
Add builtin module os containing some baisc POSIX file IO
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 0 |
18ab96287c3a
Add builtin module os containing some baisc POSIX file IO
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 } |
18ab96287c3a
Add builtin module os containing some baisc POSIX file IO
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 } |