00001 /***************************************************************************/ 00002 /* */ 00003 /* --- CAEN Engineering Srl - Computing Systems Division --- */ 00004 /* */ 00005 /* CONSOLE.H */ 00006 /* */ 00007 /* Declarations of routines which permit cursor positioning, clear */ 00008 /* screen, and other functionalities which are not implemented in the */ 00009 /* standard C library */ 00010 /* */ 00011 /* Created: January 2000 */ 00012 /* */ 00013 /***************************************************************************/ 00014 00015 00016 /***------------------------------------------------------------------------ 00017 00018 con_init 00019 Must be called before any other call to routines declared here. 00020 It initializes the console. 00021 Arguments: 00022 none 00023 Return value: 00024 none 00025 00026 --------------------------------------------------------------------***/ 00027 void con_init(void); 00028 00029 /***------------------------------------------------------------------------ 00030 00031 con_end 00032 Can be called at program shutdown the reset the console to the default 00033 values. 00034 Arguments: 00035 none 00036 Return value: 00037 none 00038 00039 --------------------------------------------------------------------***/ 00040 void con_end(void); 00041 00042 /***------------------------------------------------------------------------ 00043 00044 clrscr 00045 Clears the screen. 00046 Arguments: 00047 none 00048 Return value: 00049 none 00050 00051 --------------------------------------------------------------------***/ 00052 void clrscr(void); 00053 00054 /***------------------------------------------------------------------------ 00055 00056 highvideo 00057 Enhances any subsequent print on the screen since a call to normvideo 00058 Arguments: 00059 none 00060 Return value: 00061 none 00062 00063 --------------------------------------------------------------------***/ 00064 void highvideo(void); 00065 00066 /***------------------------------------------------------------------------ 00067 00068 normvideo 00069 End of enhanced printing. 00070 Arguments: 00071 none 00072 Return value: 00073 none 00074 00075 --------------------------------------------------------------------***/ 00076 void normvideo(void); 00077 00078 /***------------------------------------------------------------------------ 00079 00080 con_getch 00081 Reads a character from the console without waiting an enter. 00082 Arguments: 00083 none 00084 Return value: 00085 the character read 00086 00087 --------------------------------------------------------------------***/ 00088 int con_getch(void); 00089 00090 /***------------------------------------------------------------------------ 00091 00092 con_putch 00093 Sends a character to the console. 00094 Arguments: 00095 the character to print 00096 Return value: 00097 the character printed 00098 00099 --------------------------------------------------------------------***/ 00100 int con_putch(int ch); 00101 00102 /***------------------------------------------------------------------------ 00103 00104 con_puts 00105 Sends a string to the console. 00106 Arguments: 00107 the string to put 00108 Return value: 00109 the number of character printed 00110 00111 --------------------------------------------------------------------***/ 00112 int con_puts(char *s); 00113 00114 /***------------------------------------------------------------------------ 00115 00116 con_kbhit 00117 Waits a until a key is pressed. 00118 Arguments: 00119 none 00120 Return value: 00121 1 if a key is pressed, 0 if none 00122 00123 --------------------------------------------------------------------***/ 00124 int con_kbhit(void); 00125 00126 /***------------------------------------------------------------------------ 00127 00128 con_printf. 00129 Arguments: 00130 like printf 00131 Return value: 00132 like printf 00133 00134 --------------------------------------------------------------------***/ 00135 int con_printf(char *buf, ...); 00136 00137 /***------------------------------------------------------------------------ 00138 00139 con_scanf 00140 It emulates the scanf function; it only works with a fixed number of 00141 parameters. 00142 Arguments: 00143 like scanf, but only one parameter is admitted 00144 Return value: 00145 like scanf 00146 00147 --------------------------------------------------------------------***/ 00148 int con_scanf(char *fmt, void *app); 00149 00150 /***------------------------------------------------------------------------ 00151 00152 gotoxy 00153 Moves the cursor position at (x,y) 00154 Arguments: 00155 the x and y positions of the cursor 00156 Return value: 00157 none 00158 00159 --------------------------------------------------------------------***/ 00160 void gotoxy(int x, int y); 00161 00162 /***------------------------------------------------------------------------ 00163 00164 delay 00165 Waits the specified time (possibly not CPU wasting). 00166 Arguments: 00167 the time to wait in milliseconds. 00168 Return value: 00169 none 00170 00171 --------------------------------------------------------------------***/ 00172 void delay(int msec);