forked from ImortisInglorian/fbrtLib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dev_err_open.bas
42 lines (33 loc) · 874 Bytes
/
dev_err_open.bas
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
/' file device '/
#include "fb.bi"
dim shared as FB_FILE_HOOKS hooks_dev_err = ( _
@fb_DevFileEof, _
@fb_DevStdIoClose, _
NULL, _
NULL, _
@fb_DevFileRead, _
@fb_DevFileReadWstr, _
@fb_DevFileWrite, _
@fb_DevFileWriteWstr, _
NULL, _
NULL, _
@fb_DevFileReadLine, _
@fb_DevFileReadLineWstr, _
NULL, _
NULL)
extern "C"
function fb_DevErrOpen( handle as FB_FILE ptr, filename as ubyte const ptr, filename_len as size_t ) as long
dim as long res = fb_ErrorSetNum( FB_RTERROR_OK )
FB_LOCK()
handle->hooks = @hooks_dev_err
if ( handle->access = FB_FILE_ACCESS_ANY ) then
handle->access = FB_FILE_ACCESS_READWRITE
end if
if ( res = FB_RTERROR_OK ) then
handle->opaque = stderr
handle->type = FB_FILE_TYPE_PIPE
end if
FB_UNLOCK()
return res
end function
end extern