Import from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45.
[sliver-openvswitch.git] / extras / ezio / ezio.h
1 /* Copyright (c) 2008, 2009 Nicira Networks, Inc.
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  *
16  * In addition, as a special exception, Nicira Networks gives permission
17  * to link the code of its release of vswitchd with the OpenSSL project's
18  * "OpenSSL" library (or with modified versions of it that use the same
19  * license as the "OpenSSL" library), and distribute the linked
20  * executables.  You must obey the GNU General Public License in all
21  * respects for all of the code used other than "OpenSSL".  If you modify
22  * this file, you may extend this exception to your version of the file,
23  * but you are not obligated to do so.  If you do not wish to do so,
24  * delete this exception statement from your version.
25  *
26  */
27
28 #ifndef EZIO_H
29 #define EZIO_H 1
30
31 #include <stdbool.h>
32 #include <stdint.h>
33
34 /* Constants for visual representation of a row in an EZIO icon. */
35 #define e_____ 0x00
36 #define e____X 0x01
37 #define e___X_ 0x02
38 #define e___XX 0x03
39 #define e__X__ 0x04
40 #define e__X_X 0x05
41 #define e__XX_ 0x06
42 #define e__XXX 0x07
43 #define e_X___ 0x08
44 #define e_X__X 0x09
45 #define e_X_X_ 0x0a
46 #define e_X_XX 0x0b
47 #define e_XX__ 0x0c
48 #define e_XX_X 0x0d
49 #define e_XXX_ 0x0e
50 #define e_XXXX 0x0f
51 #define eX____ 0x10
52 #define eX___X 0x11
53 #define eX__X_ 0x12
54 #define eX__XX 0x13
55 #define eX_X__ 0x14
56 #define eX_X_X 0x15
57 #define eX_XX_ 0x16
58 #define eX_XXX 0x17
59 #define eXX___ 0x18
60 #define eXX__X 0x19
61 #define eXX_X_ 0x1a
62 #define eXX_XX 0x1b
63 #define eXXX__ 0x1c
64 #define eXXX_X 0x1d
65 #define eXXXX_ 0x1e
66 #define eXXXXX 0x1f
67
68 struct ezio {
69     uint8_t icons[8][8];
70     uint8_t chars[2][40];
71     int x, y, x_ofs;
72     bool show_cursor;
73     bool blink_cursor;
74 };
75
76 void ezio_init(struct ezio *);
77 void ezio_set_icon(struct ezio *, int idx,
78                    int row0, int row1, int row2, int row3,
79                    int row4, int row5, int row6, int row7);
80 void ezio_set_default_icon(struct ezio *, int idx);
81 void ezio_clear(struct ezio *);
82 void ezio_put_char(struct ezio *, int x, int y, uint8_t c);
83 void ezio_line_feed(struct ezio *);
84 void ezio_newline(struct ezio *);
85 void ezio_delete_char(struct ezio *, int x, int y, int n);
86 void ezio_delete_line(struct ezio *, int y, int n);
87 void ezio_insert_char(struct ezio *, int x, int y, int n);
88 void ezio_insert_line(struct ezio *, int y, int n);
89 void ezio_scroll_left(struct ezio *, int n);
90 void ezio_scroll_right(struct ezio *, int n);
91 void ezio_scroll_up(struct ezio *, int n);
92 void ezio_scroll_down(struct ezio *, int n);
93 bool ezio_chars_differ(const struct ezio *, const struct ezio *,
94                        int x0, int x1, int *xp, int *yp);
95
96 #endif /* ezio.h */