AlcapDAQ
1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
CAEN
CAENVMELib
CAENVMELib-2.30.2
sample
console.h
Go to the documentation of this file.
1
/*
2
-----------------------------------------------------------------------------
3
4
--- CAEN SpA - Computing Systems Division ---
5
6
-----------------------------------------------------------------------------
7
8
Name : CONSOLE.H
9
10
Description : Include file for 'Console.c'.
11
12
Add '__LINUX' define to generate a Linux exe file.
13
14
15
Date : November 2004
16
Release : 1.0
17
Author : C.Landi
18
19
20
21
-----------------------------------------------------------------------------
22
23
This file contains the following procedures & functions declaration
24
25
con_init initialize the console
26
con_end close the console
27
write_log write a message into the log file
28
con_getch get a char from console without echoing
29
con_kbhit read a char from console without stopping the program
30
con_scanf read formatted data from the console
31
con_printf print formatted output to the standard output stream
32
gotoxy set the cursor position
33
con_printf_xy print formatted output on the X,Y screen position
34
clrscr clear the screen
35
clear_line clear a line
36
delay wait n milliseconds
37
38
-----------------------------------------------------------------------------
39
*/
40
41
42
#ifndef __CONSOLE_H
43
#define __CONSOLE_H
44
45
46
//#define __LINUX
47
48
49
/****************************************************************************/
50
/* short names */
51
/****************************************************************************/
52
53
#ifndef ulong
54
#define ulong unsigned long
55
#endif
56
#ifndef uint
57
#define uint unsigned int
58
#endif
59
#ifndef ushort
60
#define ushort unsigned short
61
#endif
62
#ifndef uchar
63
#define uchar unsigned char
64
#endif
65
66
67
/*******************************************************************************/
68
/* Usefull ascii codes */
69
/*******************************************************************************/
70
71
#define CR 0x0D
/* carriage return */
72
#define BLANK 0x20
/* blank */
73
#define ESC 0x1B
/* escape */
74
#define BSP 0x08
/* back space */
75
76
/* terminal types */
77
#define TERM_NOT_INIT FALSE
78
#define TERM_INIT TRUE
79
80
81
/****************************************************************************/
82
/* CON_INIT */
83
/*--------------------------------------------------------------------------*/
84
/* Initialize the console */
85
/****************************************************************************/
86
87
void
con_init
(
void
);
88
89
90
/****************************************************************************/
91
/* CON_END */
92
/*--------------------------------------------------------------------------*/
93
/* Reset the console to the default values */
94
/****************************************************************************/
95
96
void
con_end
(
void
);
97
98
99
/******************************************************************************/
100
/* WRITE_LOG */
101
/*----------------------------------------------------------------------------*/
102
/* parameters: msg -> log message text */
103
/*----------------------------------------------------------------------------*/
104
/* Write a messege in the log file */
105
/******************************************************************************/
106
107
void
write_log
(
char
*);
108
109
110
/******************************************************************************/
111
/* CON_GETCH */
112
/*----------------------------------------------------------------------------*/
113
/* return: c -> ascii code of pressed key */
114
/*----------------------------------------------------------------------------*/
115
/* Get a char from the console without echoing and return the character read. */
116
/******************************************************************************/
117
118
int
con_getch
(
void
);
119
120
121
/******************************************************************************/
122
/* CON_KBHIT */
123
/*----------------------------------------------------------------------------*/
124
/* return: 0 -> no key pressed */
125
/* c -> ascii code of pressed key */
126
/*----------------------------------------------------------------------------*/
127
/* Rad the standard input buffer; if it is empty, return 0 else read and */
128
/* return the ascii code of the first char in the buffer. A call to this */
129
/* function doesn't stop the program if the input buffer is empty. */
130
/******************************************************************************/
131
132
char
con_kbhit
(
void
);
133
134
135
/******************************************************************************/
136
/* CON_SCANF */
137
/*----------------------------------------------------------------------------*/
138
/* parameters: fmt -> format-control string */
139
/* app -> argument */
140
/*----------------------------------------------------------------------------*/
141
/* return: number of fields that were successfully converted and */
142
/* assigned (0 -> no fields were assigned) */
143
/*----------------------------------------------------------------------------*/
144
/* Rad formatted data from the console into the locations given by argument */
145
/******************************************************************************/
146
147
int
con_scanf
(
char
*,
void
*);
148
149
150
/******************************************************************************/
151
/* CON_PRINTF */
152
/*----------------------------------------------------------------------------*/
153
/* parameters: fmt -> format string: must contain specifications */
154
/* that determine the output format for the */
155
/* argument */
156
/*----------------------------------------------------------------------------*/
157
/* return: number of characters printed */
158
/* or a negative value if an error occurs */
159
/*----------------------------------------------------------------------------*/
160
/* Print formatted output to the standard output stream */
161
/******************************************************************************/
162
163
int
con_printf
(
char
*,...);
164
165
166
/****************************************************************************/
167
/* GOTOXY */
168
/*--------------------------------------------------------------------------*/
169
/* parameters: x, y -> position on the screen */
170
/*--------------------------------------------------------------------------*/
171
/* Place the cursor at position x,y on the screen */
172
/****************************************************************************/
173
174
void
gotoxy
(
int
,
int
);
175
176
177
/****************************************************************************/
178
/* CON_PRINTF_XY */
179
/*--------------------------------------------------------------------------*/
180
/* parameters: xpos, ypos -> position on the screen */
181
/* msg -> message text */
182
/*--------------------------------------------------------------------------*/
183
/* Print a messege on the X,Y screen position */
184
/****************************************************************************/
185
186
int
con_printf_xy
(
uint
,
uint
,
char
*,...);
187
188
189
/****************************************************************************/
190
/* CLRSCR */
191
/*--------------------------------------------------------------------------*/
192
/* Clear the screen */
193
/****************************************************************************/
194
195
void
clrscr
(
void
);
196
197
198
/****************************************************************************/
199
/* CLEAR_LINE */
200
/*--------------------------------------------------------------------------*/
201
/* parameters: line -> line to clear */
202
/*--------------------------------------------------------------------------*/
203
/* Clear a line of the screen */
204
/****************************************************************************/
205
206
void
clear_line
(
uint
);
207
208
209
/****************************************************************************/
210
/* DELAY */
211
/*--------------------------------------------------------------------------*/
212
/* parameters: del -> delay in millisecond */
213
/*--------------------------------------------------------------------------*/
214
/* Wait n milliseconds */
215
/****************************************************************************/
216
217
void
delay
(
int
);
218
219
220
#endif
221
Generated by
1.8.4