1 /*
2 NETWIB
3 Network library
4 Copyright(c) 1999-2010 Laurent Constantin
5 -----
6
7 Main server : http://www.laurentconstantin.com/
8 Backup server : http://laurentconstantin.free.fr/
9 [my current email address is on the web servers]
10
11 -----
12 This file is part of Netwib.
13
14 Netwib is free software: you can redistribute it and/or modify
15 it under the terms of the GNU General Public License version 3
16 as published by the Free Software Foundation.
17
18 Netwib is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details (http://www.gnu.org/).
22
23 ------------------------------------------------------------------------
24 */
25
26 #include <netwib/inc/maininc.h>
27
28 /*-------------------------------------------------------------*/
netwib_priv_io_screen_write(netwib_io * pio,netwib_constbuf * pbuf)29 static netwib_err netwib_priv_io_screen_write(netwib_io *pio,
30 netwib_constbuf *pbuf)
31 {
32 netwib_er(netwib_buf_display(pbuf, NETWIB_ENCODETYPE_DATA));
33 pio = pio; /* for compiler warning */
34 return(NETWIB_ERR_OK);
35 }
36
37 /*-------------------------------------------------------------*/
netwib_priv_io_screen_wait(netwib_io * pio,netwib_io_waytype way,netwib_consttime * pabstime,netwib_bool * pevent)38 static netwib_err netwib_priv_io_screen_wait(netwib_io *pio,
39 netwib_io_waytype way,
40 netwib_consttime *pabstime,
41 netwib_bool *pevent)
42 {
43 /* suppose it's always possible to write to screen
44 (note : we do not have to bother with way because
45 piocommon->rd.initialized==NETWIB_FALSE) */
46 if (pevent != NULL) *pevent = NETWIB_TRUE;
47
48 pio = pio; /* for compiler warning */
49 way = way; /* for compiler warning */
50 pabstime = pabstime; /* for compiler warning */
51 return(NETWIB_ERR_OK);
52 }
53
54 /*-------------------------------------------------------------*/
netwib_priv_io_screen_ctl_set(netwib_io * pio,netwib_io_waytype way,netwib_io_ctltype type,netwib_ptr p,netwib_uint32 ui)55 static netwib_err netwib_priv_io_screen_ctl_set(netwib_io *pio,
56 netwib_io_waytype way,
57 netwib_io_ctltype type,
58 netwib_ptr p,
59 netwib_uint32 ui)
60 {
61 switch(type) {
62 case NETWIB_IO_CTLTYPE_RES:
63 return(NETWIB_ERR_PAINVALIDTYPE);
64 break;
65 case NETWIB_IO_CTLTYPE_END:
66 if (way != NETWIB_IO_WAYTYPE_WRITE) return(NETWIB_ERR_PAINVALIDTYPE);
67 pio->wr.supported = NETWIB_FALSE;
68 return(NETWIB_ERR_OK);
69 break;
70 default:
71 return(NETWIB_ERR_PLEASETRYNEXT);
72 }
73
74 p = p; /* for compiler warning */
75 ui = ui; /* for compiler warning */
76 return(NETWIB_ERR_PLEASETRYNEXT);
77 }
78
79 /*-------------------------------------------------------------*/
netwib_priv_io_screen_ctl_get(netwib_io * pio,netwib_io_waytype way,netwib_io_ctltype type,netwib_ptr p,netwib_uint32 * pui)80 static netwib_err netwib_priv_io_screen_ctl_get(netwib_io *pio,
81 netwib_io_waytype way,
82 netwib_io_ctltype type,
83 netwib_ptr p,
84 netwib_uint32 *pui)
85 {
86 switch(type) {
87 case NETWIB_IO_CTLTYPE_RES:
88 if (pui != NULL) *pui = NETWIB_IO_RESTYPE_SCREEN;
89 return(NETWIB_ERR_OK);
90 case NETWIB_IO_CTLTYPE_END:
91 return(NETWIB_ERR_PAINVALIDTYPE);
92 default:
93 return(NETWIB_ERR_PLEASETRYNEXT);
94 }
95
96 pio = pio; /* for compiler warning */
97 way = way; /* for compiler warning */
98 p = p; /* for compiler warning */
99 return(NETWIB_ERR_PLEASETRYNEXT);
100 }
101
102 /*-------------------------------------------------------------*/
netwib_priv_io_screen_close(netwib_io * pio)103 static netwib_err netwib_priv_io_screen_close(netwib_io *pio)
104 {
105 pio = pio; /* for compiler warning */
106 return(NETWIB_ERR_OK);
107 }
108
109 /*-------------------------------------------------------------*/
netwib_io_init_screen(netwib_io ** ppio)110 netwib_err netwib_io_init_screen(netwib_io **ppio)
111 {
112 netwib_er(netwib_io_init(NETWIB_FALSE, NETWIB_TRUE,
113 NULL,
114 NULL,
115 &netwib_priv_io_screen_write,
116 &netwib_priv_io_screen_wait,
117 NULL,
118 &netwib_priv_io_screen_ctl_set,
119 &netwib_priv_io_screen_ctl_get,
120 &netwib_priv_io_screen_close,
121 ppio));
122
123 return(NETWIB_ERR_OK);
124 }
125
126
127