-
Notifications
You must be signed in to change notification settings - Fork 0
/
reuse.n
210 lines (179 loc) · 5.67 KB
/
reuse.n
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
using System.Runtime.InteropServices;
enum TaskStatus {
| ERROR = 0 /* error occured */
| STOPPED = 1 /* task is not started */
| RUNNING = 2 /* task is runnning */
| EXITED = 3 /* task has exited */
| SIGNALED = 4 /* task was terminated by a signal */
}
enum Fd {
| Stdin = 0
| Stdout = 1
| Stderr = 2
}
enum FdOp {
| CLOSE = 0 /* close file descriptor */
| FILE = 1 /* redirect to/from file */
| DUP = 2 /* duplicate file descriptor */
| PIPE = 3 /* pipe the file descriptor */
};
enum FileOpenFlags {
| REWRITE = 0x10000
| WRITE = 0x20000
| READ = 0x30000
}
enum FileOpenModes {
| FULL_RW = 0o666
}
enum PipeMode {
| READ = 0
| WRITE = 1
}
module Reuse {
[DllImport ("reuse")]
[return: MarshalAs (UnmanagedType.LPStruct)]
public extern task_New () : System.IntPtr;
[DllImport ("reuse")]
public extern task_Delete (
[MarshalAs (UnmanagedType.LPStruct)] o : System.IntPtr
) : void;
[DllImport ("reuse")]
public extern task_SetPath (
[MarshalAs (UnmanagedType.LPStruct)] this o : System.IntPtr,
[MarshalAs (UnmanagedType.LPStr)] s : string
) : int;
[DllImport ("reuse")]
public extern task_SetMaxTimeMillis (
[MarshalAs (UnmanagedType.LPStruct)]
this o : System.IntPtr,
ms : int
) : int;
[DllImport ("reuse")]
public extern task_SetMaxTime (
[MarshalAs (UnmanagedType.LPStruct)]
this o : System.IntPtr,
s : int
) : int;
[DllImport ("reuse")]
public extern task_SetMaxRealTime (
[MarshalAs (UnmanagedType.LPStruct)]
this o : System.IntPtr,
s : int
) : int;
[DllImport ("reuse")]
public extern task_Start (
[MarshalAs (UnmanagedType.LPStruct)]
this o : System.IntPtr
) : int;
[DllImport ("reuse")]
public extern task_GetRunningTime (
[MarshalAs (UnmanagedType.LPStruct)]
this o : System.IntPtr
) : int;
[DllImport ("reuse")]
public extern task_GetRealTime (
[MarshalAs (UnmanagedType.LPStruct)]
this o : System.IntPtr
) : int;
[DllImport ("reuse")]
[return: MarshalAs (UnmanagedType.LPStruct)]
public extern task_Wait (
[MarshalAs (UnmanagedType.LPStruct)]
this o : System.IntPtr
) : System.IntPtr;
[DllImport ("reuse")]
public extern task_Status (
[MarshalAs (UnmanagedType.LPStruct)]
this o : System.IntPtr
) : int;
[DllImport ("reuse")]
public extern task_ExitCode (
[MarshalAs (UnmanagedType.LPStruct)]
this o : System.IntPtr
) : int;
[DllImport ("reuse")]
public extern task_AddArg (
[MarshalAs (UnmanagedType.LPStruct)]
this o : System.IntPtr,
[MarshalAs (UnmanagedType.LPStr)]
ms : string
) : int;
[DllImport ("reuse", EntryPoint = "task_SetRedir")]
private extern task_SetRedirFile (
[MarshalAs (UnmanagedType.LPStruct)]
o : System.IntPtr,
[MarshalAs (UnmanagedType.I4)]
fd : Fd,
[MarshalAs (UnmanagedType.I4)]
fdop_file : FdOp,
[MarshalAs (UnmanagedType.LPStr)]
fn : string,
[MarshalAs (UnmanagedType.I4)]
fdop_flag : FileOpenFlags,
[MarshalAs (UnmanagedType.I4)]
fdop_mode : FileOpenModes,
) : int;
public task_SetRedirFile (this o : System.IntPtr, fd : Fd, fn : string, fdop_flag : FileOpenFlags, fdop_mode : FileOpenModes = FileOpenModes.FULL_RW) : int {
task_SetRedirFile (o, fd, FdOp.FILE, fn, fdop_flag, fdop_mode)
}
[DllImport ("reuse", EntryPoint = "task_SetRedir")]
private extern task_SetRedirClose (
[MarshalAs (UnmanagedType.LPStruct)] o : System.IntPtr,
[MarshalAs (UnmanagedType.I4)] fd : Fd,
[MarshalAs (UnmanagedType.I4)] fdop_close : FdOp,
) : void;
public task_SetRedirClose (this o : System.IntPtr, fd : Fd) : void {
task_SetRedirClose (o, fd, FdOp.CLOSE)
}
[DllImport ("reuse", EntryPoint = "task_SetRedir")]
private extern task_SetRedirDup (
[MarshalAs (UnmanagedType.LPStruct)] o : System.IntPtr,
[MarshalAs (UnmanagedType.I4)] fd : Fd,
[MarshalAs (UnmanagedType.I4)] fdop_dup : FdOp,
[MarshalAs (UnmanagedType.I4)] fd2 : Fd,
) : void;
public task_SetRedirDup (this o : System.IntPtr, fd : Fd, fd2 : Fd) : void {
task_SetRedirDup (o, fd, FdOp.DUP, fd2)
}
[DllImport ("reuse", EntryPoint = "task_SetRedir")]
private extern task_SetRedirPipe (
[MarshalAs (UnmanagedType.LPStruct)] o : System.IntPtr,
[MarshalAs (UnmanagedType.I4)] fd : Fd,
[MarshalAs (UnmanagedType.I4)] fdop_pipe : FdOp,
[MarshalAs (UnmanagedType.I4)] pm : PipeMode,
) : void;
public task_RedirPipe (this o : System.IntPtr, fd : Fd, pm : PipeMode) : void {
task_SetRedirPipe (o, fd, FdOp.PIPE, pm)
}
[DllImport ("reuse")]
public extern task_SetStackSize (
[MarshalAs (UnmanagedType.LPStruct)] this o : System.IntPtr,
size : int
) : int;
[DllImport ("reuse")]
public extern task_SetDataSize (
[MarshalAs (UnmanagedType.LPStruct)] this o : System.IntPtr,
size : int
) : int;
[DllImport ("reuse")]
public extern task_SetVMSize (
[MarshalAs (UnmanagedType.LPStruct)] this o : System.IntPtr,
size : int
) : int;
[DllImport ("reuse")]
public extern task_EnableMemoryLimitError (
[MarshalAs (UnmanagedType.LPStruct)] this o : System.IntPtr,
) : int;
[DllImport ("reuse")]
public extern task_IsAbnormal (
[MarshalAs (UnmanagedType.LPStruct)] this o : System.IntPtr
) : int;
[DllImport ("reuse")]
public extern task_IsTimeout (
[MarshalAs (UnmanagedType.LPStruct)] this o : System.IntPtr
) : int;
[DllImport ("reuse")]
public extern task_IsMemoryLimit (
[MarshalAs (UnmanagedType.LPStruct)] this o : System.IntPtr
) : int;
}