r41: ANSI C changes
[ctsim.git] / include / cio.h
1 /*****************************************************************************
2 **  This is part of the CTSim program
3 **  Copyright (C) 1983-2000 Kevin Rosenberg
4 **
5 **  $Id: cio.h,v 1.6 2000/05/08 20:00:47 kevin Exp $
6 **  $Log: cio.h,v $
7 **  Revision 1.6  2000/05/08 20:00:47  kevin
8 **  ANSI C changes
9 **
10 **  Revision 1.5  2000/05/07 12:46:19  kevin
11 **  made c++ compatible
12 **
13 **  Revision 1.4  2000/04/28 18:18:59  kevin
14 **  removed unused files
15 **
16 **  Revision 1.3  2000/04/28 14:14:16  kevin
17 **  *** empty log message ***
18 **
19 **
20 **  This program is free software; you can redistribute it and/or modify
21 **  it under the terms of the GNU General Public License (version 2) as
22 **  published by the Free Software Foundation.
23 **
24 **  This program is distributed in the hope that it will be useful,
25 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
26 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27 **  GNU General Public License for more details.
28 **
29 **  You should have received a copy of the GNU General Public License
30 **  along with this program; if not, write to the Free Software
31 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
32 ******************************************************************************/
33 #ifndef __CIO_H
34 #define __CIO_H
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39
40
41 struct crtv_st {
42     int init;           /* True if initialized */
43     int bios_mode;      /* Current BIOS crt mode */
44     int text_attr;      /* Current text attribute */
45     int act_page;       /* Active page */
46     int tcols, trows;   /* Maximum text coords */
47     int xmax, ymax;     /* Maximum x, y for both text & graphic modes */
48     int cx, cy;         /* Current x, y position */
49 }; 
50
51 #ifndef DEFINE_CRTV
52    extern struct crtv_st crtv;
53 #endif
54
55 /*----------------------------------------------------------------------*/
56
57 #define CRT_ROWS  25
58 #define CRT_COLS  80
59
60 /*----------------------------------------------------------------------*/
61
62 #define  ATTR_NORMAL     7
63 #define  ATTR_REVERSE   14
64 #define  ATTR_HIGHLIGHT 15
65
66 #define C_BLACK      0                  /* color codes */
67 #define C_BLUE       1
68 #define C_GREEN      2
69 #define C_CYAN       3
70 #define C_RED        4
71 #define C_MAGENTA    5
72 #define C_BROWN      6
73 #define C_WHITE      7
74 #define C_GREY       8
75 #define C_LTBLUE     9
76 #define C_LTGREEN   10
77 #define C_LTCYAN    11
78 #define C_LTRED     12
79 #define C_LTMAGENTA 13
80 #define C_YELLOW    14
81 #define C_LTWHITE   15
82
83 /*----------------------------------------------------------------------*/
84
85 /* screen character codes */
86
87 #define SC_BKSP           8
88 #define SC_TAB            9
89 #define SC_BLANK        ' '
90
91
92 #define WAITKEY()       {cio_kb_clr(); while (cio_kb_read() == 0);}
93
94 /* center.c */
95 void crt_center_line(const char *str);
96 /* clreol.c */
97 void cio_clreol(void);
98 /* clrline.c */
99 void cio_clrline(unsigned int line);
100 /* clrscrn.c */
101 void crt_clrscrn(void);
102 /* cpos.c */
103 void cio_tab(unsigned int n);
104 void cio__save_cpos(void);
105 void cio__restore_cpos(void);
106 /* fill_eol.c */
107 void cio_fill_eol(int c, int attr);
108 /* getstate.c */
109 void cio_get_state(void);
110 /* put_ca.c */
111 void cio_set_text_clr(int fclr, int bclr);
112 int cio_get_texta(void);
113 void cio_set_texta(int a);
114 int cio_blank_attr(void);
115 void cio_put_ca(int c, int attr);
116 void cio_put_c(int c);
117 void cio_put_cc(int c, int count);
118 void cio_put_cca(int c, int attr, int count);
119 void cio_put_str(const char *str);
120 void cio_put_stra(const char *str, int attr);
121 void cio_inc_col(int count);
122 void cio_dec_col(int count);
123 void cio_dec_row(int count);
124 /* setcpos.c */
125 void cio_set_cpos(int col, int row);
126 void cio_get_cpos(int *col, int *row);
127 /* beep.c */
128 void cio_beep(void);
129 /* kb_chk.c */
130 int cio_kb_chk(void);
131 /* kb_clr.c */
132 void cio_kb_clr(void);
133 /* kb_getc.c */
134 unsigned int cio_kb_getc(void);
135 void cio_kb_ungetc(unsigned int c);
136 /* kb_gets.c */
137 char *cio_kb_gets(char *str, int maxlen);
138 /* kb_read.c */
139 unsigned int cio_kb_read(void);
140 void cio_kb_unread(unsigned int c);
141 /* kb_waitc.c */
142 unsigned int cio_kb_waitc(const char *astr, const char *estr, int beep_on_error);
143 /* tone.c */
144 void cio_tone(double freq, double length);
145 /* check_kb */
146 int cio_check_kb_escape(void);
147
148 #ifdef _cplusplus
149 }
150 #endif /* _cplusplus */
151
152 #endif