1 /* knocker version 0.8.0
2  * Release date: 28 December 2020
3  *
4  * Project homepage: https://knocker.sourceforge.io
5  *
6  * Copyright 2001,2020 Gabriele Giorgetti <g.giorgetti@gmail.com>
7  *
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22 */
23 
24 #ifndef _KNOCKER_TERM_H_
25 #define _KNOCKER_TERM_H_
26 
27 #ifdef HAVE_CONFIG_H
28 #  include <config.h>
29 #endif
30 
31 #include <stdio.h>
32 
33 #ifdef __WIN32__
34 #include <conio.h>
35 #define COLOR_BLACK       BLACK
36 #define COLOR_BLUE        BLUE
37 #define COLOR_GREEN       GREEN
38 #define COLOR_CYAN        CYAN
39 #define COLOR_RED         RED
40 #define COLOR_MAGENTA     MAGENTA
41 #define COLOR_WHITE       WHITE
42 #define COLOR_YELLOW      YELLOW
43 #else
44 enum
45 {
46   COLOR_BLACK, COLOR_RED, COLOR_GREEN,
47   COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA,
48   COLOR_CYAN, COLOR_WHITE
49 };
50 #endif /* __WIN_32__ */
51 
52 #define COLOR_NONE        -2002 /* just to be sure it doesn't conflict with other colors */
53 
54 enum
55 {
56   ATTRIB_RESET, ATTRIB_BRIGHT, ATTRIB_DIM, ATTRIB_UNDERLINE,
57   ATTRIB_BLINK, ATTRIB_REVERSE, ATTRIB_HIDDEN
58 };
59 
60 
61 void knocker_term_clear ( void );
62 
63 void knocker_term_set_color (int fg, int bg, int attrib);
64 void knocker_term_set_default_color (void);
65 void knocker_term_reset (void);
66 
67 void knocker_term_fflush (FILE *fd);
68 
69 void knocker_term_printf (const char *buffer);
70 void knocker_term_fprintf (FILE * fd, const char *buffer);
71 void knocker_term_intfprintf (FILE * fd, const int i);
72 
73 void knocker_term_color_printf (const char *buffer, int color, int attrib);
74 void knocker_term_color_fprintf (FILE * fd, const char *buffer, int color, int attrib);
75 
76 void knocker_term_color_intprintf (const int i, int color, int attrib);
77 void knocker_term_color_intfprintf (FILE * fd, const int i, int color, int attrib);
78 
79 #endif /* _KNOCKER_TERM_H_ */
80 
81