-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfilesystem.wu
80 lines (67 loc) · 3.38 KB
/
filesystem.wu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import types { Object_T, Data }
# BufferMode: enum {"none", "line", "full"}
# FileMode: enum {"r", "w", "a", "c"}
# ContainerType: enum {"data", "string"}
File: struct {}
File_T: trait {
close: fun(self) -> bool
flush: fun(self) -> (bool, str?)
getBuffer: fun(self) -> (str, int) # fun(self) -> (BufferMode, int)
getFilename: fun(self) -> str
getMode: fun(self) -> str # fun(self) -> FileMode
getSize: fun(self) -> int
isEOF: fun(self) -> bool
isOpen: fun(self) -> bool
lines: fun(self) -> fun
open: fun(self, str) -> (bool, str?) # fun(self, FileMode) -> (bool, str?)
read: fun(self, str, int?) -> (any, int) # (self, int|ContainerType, int?) -> (str|FileData, int)
seek: fun(self, int) -> bool
setBuffer: fun(self, str, int?) -> (bool, str?) # fun(self, BufferMode, int?) -> (bool, str?)
tell: fun(self) -> int
write: fun(self, any, int?) -> (bool, str?) # (self, str|Data, int?) -> bool, str?
}
implement File: Object_T {
release: extern fun(self) -> bool
type: extern fun(self) -> str
typeOf: extern fun(self, str) -> bool
}
implement File: File_T {
close: extern fun(self) -> bool
flush: extern fun(self) -> (bool, str?)
getBuffer: extern fun(self) -> (str, int) # fun(self) -> (BufferMode, int)
getFilename: extern fun(self) -> str
getMode: extern fun(self) -> str # fun(self) -> FileMode
getSize: extern fun(self) -> int
isEOF: extern fun(self) -> bool
isOpen: extern fun(self) -> bool
lines: extern fun(self) -> fun
open: extern fun(self, str) -> (bool, str?) # fun(self, FileMode) -> (bool, str?)
read: extern fun(self, str, int?) -> (any, int) # (self, int|ContainerType, int?) -> (str|FileData, int)
seek: extern fun(self, int) -> bool
setBuffer: extern fun(self, str, int?) -> (bool, str?) # fun(self, BufferMode, int?) -> (bool, str?)
tell: extern fun(self) -> int
write: extern fun(self, any, int?) -> (bool, str?) # (self, str|Data, int?) -> bool, str?
}
DroppedFile: struct {}
implement DroppedFile: Object_T {
release: extern fun(self) -> bool
type: extern fun(self) -> str
typeOf: extern fun(self, str) -> bool
}
implement DroppedFile: File_T {
close: extern fun(self) -> bool
flush: extern fun(self) -> (bool, str?)
getBuffer: extern fun(self) -> (str, int) # fun(self) -> (BufferMode, int)
getFilename: extern fun(self) -> str
getMode: extern fun(self) -> str # fun(self) -> FileMode
getSize: extern fun(self) -> int
isEOF: extern fun(self) -> bool
isOpen: extern fun(self) -> bool
lines: extern fun(self) -> fun
open: extern fun(self, str) -> (bool, str?) # fun(self, FileMode) -> (bool, str?)
read: extern fun(self, str, int?) -> (any, int) # (self, int|ContainerType, int?) -> (str|FileData, int)
seek: extern fun(self, int) -> bool
setBuffer: extern fun(self, str, int?) -> (bool, str?) # fun(self, BufferMode, int?) -> (bool, str?)
tell: extern fun(self) -> int
write: extern fun(self, any, int?) -> (bool, str?) # (self, str|Data, int?) -> bool, str?
}