aboutsummaryrefslogtreecommitdiff
path: root/types/lfs.d.tl
blob: ff0ad1eddfc38e0fe2a37fcccd1e90603bc472c0 (plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
local record lfs

   enum FileMode
      "file"
      "directory"
      "link"
      "socket"
      "named pipe"
      "char device"
      "block device"
      "other"
   end

   record Attributes
      dev: integer
      ino: integer
      mode: FileMode
      nlink: integer
      uid: integer
      gid: integer
      rdev: integer
      access: integer
      modification: integer
      change: integer
      size: integer
      permissions: string
      blocks: integer
      blksize: integer
   end

   enum AttributeSelInt
      "dev"
      "ino"
      "nlink"
      "uid"
      "gid"
      "rdev"
      "access"
      "modification"
      "change"
      "size"
      "blocks"
      "blksize"
   end

   enum AttributeSelStr
      "permissions"
   end

   enum AttributeSelFM
      "mode"
   end

   enum OpenFileMode
      "binary"
      "text"
   end

   enum LockMode
      "r"
      "w"
   end

   record Lock
      free: function(self)
   end

   record DirObj
      next: function(self): string
      close: function(self)
   end

   dir: function(string): function(DirObj): (string), DirObj, nil, DirObj

   chdir: function(string): boolean, string

   lock_dir: function(string, ? integer): Lock, string

   link: function(string, string, ? boolean): boolean, string

   mkdir: function(string): boolean, string, integer

   rmdir: function(string): boolean, string, integer

   setmode: function(string, OpenFileMode): boolean, string

   currentdir: function(): string, string

   attributes: function(string): Attributes
   attributes: function(string, AttributeSelStr): string
   attributes: function(string, AttributeSelInt): integer
   attributes: function(string, AttributeSelFM): FileMode
   attributes: function(string, Attributes): Attributes

   symlinkattributes: function(string): Attributes
   symlinkattributes: function(string, AttributeSelStr): string
   symlinkattributes: function(string, AttributeSelInt): integer
   symlinkattributes: function(string, AttributeSelFM): FileMode
   symlinkattributes: function(string, Attributes): Attributes

   touch: function(string, ? integer, ? integer): boolean, string

   -- TODO: FILE needs to be renamed to io.FILE in tl itself
   lock:   function(FILE, LockMode, ? integer, ? integer): boolean, string
   unlock: function(FILE,           ? integer, ? integer): boolean, string

end

return lfs