annotate samples/osmod.tp @ 377:93c28eee141e default tip

Merge
author Michael Pavone <pavone@retrodev.com>
date Sat, 15 Aug 2015 22:45:33 -0700
parents d1dc2d70bdfd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 }