FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
dev_scrn.c
Go to the documentation of this file.
1
/* file device */
2
3
#include "
fb.h
"
4
5
void
fb_DevScrnInit_Screen
(
void
);
6
7
static
FB_FILE_HOOKS
hooks_dev_scrn
= {
8
fb_DevScrnEof
,
9
fb_DevScrnClose
,
10
NULL
,
11
NULL
,
12
fb_DevScrnRead
,
13
fb_DevScrnReadWstr
,
14
fb_DevScrnWrite
,
15
fb_DevScrnWriteWstr
,
16
NULL
,
17
NULL
,
18
fb_DevScrnReadLine
,
19
fb_DevScrnReadLineWstr
20
};
21
22
int
fb_DevScrnOpen
(
FB_FILE
*
handle
,
const
char
*
filename
,
size_t
filename_len )
23
{
24
FB_LOCK
();
25
26
if
(handle!=
FB_HANDLE_SCREEN
)
27
{
28
DEV_SCRN_INFO
*info = (
DEV_SCRN_INFO
*)
FB_HANDLE_SCREEN
->opaque;
29
handle->
hooks
= &hooks_dev_scrn;
30
handle->
opaque
= info;
31
handle->
redirection_to
=
FB_HANDLE_SCREEN
;
32
33
}
34
else
if
( handle->
hooks
!= &hooks_dev_scrn )
35
{
36
if
( handle->
hooks
==
NULL
)
37
fb_DevScrnInit_Screen
( );
38
handle->
hooks
= &
hooks_dev_scrn
;
39
handle->
type
=
FB_FILE_TYPE_CONSOLE
;
40
}
41
42
FB_UNLOCK
();
43
44
return
fb_ErrorSetNum
(
FB_RTERROR_OK
);
45
}
46
47
void
fb_DevScrnInit
(
void
)
48
{
49
if
(
FB_HANDLE_SCREEN
->hooks ==
NULL
)
50
{
51
FB_LOCK
();
52
53
memset(
FB_HANDLE_SCREEN
, 0,
sizeof
(*
FB_HANDLE_SCREEN
));
54
55
FB_HANDLE_SCREEN
->mode =
FB_FILE_MODE_APPEND
;
56
FB_HANDLE_SCREEN
->encod =
FB_FILE_ENCOD_DEFAULT
;
57
FB_HANDLE_SCREEN
->type =
FB_FILE_TYPE_VFS
;
58
FB_HANDLE_SCREEN
->access =
FB_FILE_ACCESS_READWRITE
;
59
60
fb_DevScrnOpen
(
FB_HANDLE_SCREEN
,
NULL
, 0 );
61
62
FB_UNLOCK
();
63
}
64
else
if
(
FB_HANDLE_SCREEN
->hooks != &hooks_dev_scrn )
65
{
66
FB_HANDLE_SCREEN
->hooks = &
hooks_dev_scrn
;
67
}
68
}
rtlib
dev_scrn.c
Generated on Thu Jan 23 2014 19:40:08 for FreeBASIC by
1.8.4