您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

277 行
8.2 KiB

  1. /*
  2. * libcaca Colour ASCII-Art library
  3. * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This library is free software. It comes without any warranty, to
  9. * the extent permitted by applicable law. You can redistribute it
  10. * and/or modify it under the terms of the Do What The Fuck You Want
  11. * To Public License, Version 2, as published by Sam Hocevar. See
  12. * http://sam.zoy.org/wtfpl/COPYING for more details.
  13. */
  14. /*
  15. * This header contains a conio.h reimplementation.
  16. */
  17. #ifndef __CACA_CONIO_H__
  18. #define __CACA_CONIO_H__
  19. #include <caca.h>
  20. #if !defined(__KERNEL__)
  21. # include <stdio.h>
  22. #endif
  23. #undef __extern
  24. #if defined(_DOXYGEN_SKIP_ME)
  25. #elif defined(_WIN32) && defined(__LIBCACA__)
  26. # define __extern extern __declspec(dllexport)
  27. #else
  28. # define __extern extern
  29. #endif
  30. #ifdef __cplusplus
  31. extern "C"
  32. {
  33. #endif
  34. /* conio.h enums and global variables */
  35. enum CACA_CONIO_COLORS
  36. {
  37. CACA_CONIO_BLINK = 128,
  38. CACA_CONIO_BLACK = 0,
  39. CACA_CONIO_BLUE = 1,
  40. CACA_CONIO_GREEN = 2,
  41. CACA_CONIO_CYAN = 3,
  42. CACA_CONIO_RED = 4,
  43. CACA_CONIO_MAGENTA = 5,
  44. CACA_CONIO_BROWN = 6,
  45. CACA_CONIO_LIGHTGRAY = 7,
  46. CACA_CONIO_DARKGRAY = 8,
  47. CACA_CONIO_LIGHTBLUE = 9,
  48. CACA_CONIO_LIGHTGREEN = 10,
  49. CACA_CONIO_LIGHTCYAN = 11,
  50. CACA_CONIO_LIGHTRED = 12,
  51. CACA_CONIO_LIGHTMAGENTA = 13,
  52. CACA_CONIO_YELLOW = 14,
  53. CACA_CONIO_WHITE = 15,
  54. };
  55. __extern int caca_conio_directvideo;
  56. enum CACA_CONIO_CURSOR
  57. {
  58. CACA_CONIO__NOCURSOR = 0,
  59. CACA_CONIO__SOLIDCURSOR = 1,
  60. CACA_CONIO__NORMALCURSOR = 2,
  61. };
  62. struct caca_conio_text_info
  63. {
  64. unsigned char winleft; /* left window coordinate */
  65. unsigned char wintop; /* top window coordinate */
  66. unsigned char winright; /* right window coordinate */
  67. unsigned char winbottom; /* bottom window coordinate */
  68. unsigned char attribute; /* text attribute */
  69. unsigned char normattr; /* normal attribute */
  70. unsigned char currmode; /* current video mode:
  71. BW40, BW80, C40, C80, or C4350 */
  72. unsigned char screenheight; /* text screen's height */
  73. unsigned char screenwidth; /* text screen's width */
  74. unsigned char curx; /* x-coordinate in current window */
  75. unsigned char cury; /* y-coordinate in current window */
  76. };
  77. enum CACA_CONIO_MODE
  78. {
  79. CACA_CONIO_LASTMODE = -1,
  80. CACA_CONIO_BW40 = 0,
  81. CACA_CONIO_C40 = 1,
  82. CACA_CONIO_BW80 = 2,
  83. CACA_CONIO_C80 = 3,
  84. CACA_CONIO_MONO = 7,
  85. CACA_CONIO_C4350 = 64,
  86. };
  87. __extern int caca_conio__wscroll;
  88. #if !defined _DOXYGEN_SKIP_ME && !defined __LIBCACA__
  89. # undef BLINK
  90. # define BLINK CACA_CONIO_BLINK
  91. # undef BLACK
  92. # define BLACK CACA_CONIO_BLACK
  93. # undef BLUE
  94. # define BLUE CACA_CONIO_BLUE
  95. # undef GREEN
  96. # define GREEN CACA_CONIO_GREEN
  97. # undef CYAN
  98. # define CYAN CACA_CONIO_CYAN
  99. # undef RED
  100. # define RED CACA_CONIO_RED
  101. # undef MAGENTA
  102. # define MAGENTA CACA_CONIO_MAGENTA
  103. # undef BROWN
  104. # define BROWN CACA_CONIO_BROWN
  105. # undef LIGHTGRAY
  106. # define LIGHTGRAY CACA_CONIO_LIGHTGRAY
  107. # undef DARKGRAY
  108. # define DARKGRAY CACA_CONIO_DARKGRAY
  109. # undef LIGHTBLUE
  110. # define LIGHTBLUE CACA_CONIO_LIGHTBLUE
  111. # undef LIGHTGREEN
  112. # define LIGHTGREEN CACA_CONIO_LIGHTGREEN
  113. # undef LIGHTCYAN
  114. # define LIGHTCYAN CACA_CONIO_LIGHTCYAN
  115. # undef LIGHTRED
  116. # define LIGHTRED CACA_CONIO_LIGHTRED
  117. # undef LIGHTMAGENTA
  118. # define LIGHTMAGENTA CACA_CONIO_LIGHTMAGENTA
  119. # undef YELLOW
  120. # define YELLOW CACA_CONIO_YELLOW
  121. # undef WHITE
  122. # define WHITE CACA_CONIO_WHITE
  123. # undef directvideo
  124. # define directvideo caca_conio_directvideo
  125. # undef _NOCURSOR
  126. # define _NOCURSOR CACA_CONIO__NOCURSOR
  127. # undef _SOLIDCURSOR
  128. # define _SOLIDCURSOR CACA_CONIO__SOLIDCURSOR
  129. # undef _NORMALCURSOR
  130. # define _NORMALCURSOR CACA_CONIO__NORMALCURSOR
  131. # undef text_info
  132. # define text_info caca_conio_text_info
  133. # undef LASTMODE
  134. # define LASTMODE CACA_CONIO_LASTMODE
  135. # undef BW40
  136. # define BW40 CACA_CONIO_BW40
  137. # undef C40
  138. # define C40 CACA_CONIO_C40
  139. # undef BW80
  140. # define BW80 CACA_CONIO_BW80
  141. # undef C80
  142. # define C80 CACA_CONIO_C80
  143. # undef MONO
  144. # define MONO CACA_CONIO_MONO
  145. # undef C4350
  146. # define C4350 CACA_CONIO_C4350
  147. # undef _wscroll
  148. # define _wscroll caca_conio__wscroll
  149. #endif
  150. /* conio.h functions */
  151. __extern char * caca_conio_cgets(char *str);
  152. __extern void caca_conio_clreol(void);
  153. __extern void caca_conio_clrscr(void);
  154. __extern int caca_conio_cprintf(const char *format, ...);
  155. __extern int caca_conio_cputs(const char *str);
  156. __extern int caca_conio_cscanf(char *format, ...);
  157. __extern void caca_conio_delay(unsigned int);
  158. __extern void caca_conio_delline(void);
  159. __extern int caca_conio_getch(void);
  160. __extern int caca_conio_getche(void);
  161. __extern char * caca_conio_getpass(const char *prompt);
  162. __extern int caca_conio_gettext(int left, int top, int right, int bottom,
  163. void *destin);
  164. __extern void caca_conio_gettextinfo(struct caca_conio_text_info *r);
  165. __extern void caca_conio_gotoxy(int x, int y);
  166. __extern void caca_conio_highvideo(void);
  167. __extern void caca_conio_insline(void);
  168. __extern int caca_conio_kbhit(void);
  169. __extern void caca_conio_lowvideo(void);
  170. __extern int caca_conio_movetext(int left, int top, int right, int bottom,
  171. int destleft, int desttop);
  172. __extern void caca_conio_normvideo(void);
  173. __extern void caca_conio_nosound(void);
  174. __extern int caca_conio_printf(const char *format, ...);
  175. __extern int caca_conio_putch(int ch);
  176. __extern int caca_conio_puttext(int left, int top, int right, int bottom,
  177. void *destin);
  178. __extern void caca_conio__setcursortype(int cur_t);
  179. __extern void caca_conio_sleep(unsigned int);
  180. __extern void caca_conio_sound(unsigned int);
  181. __extern void caca_conio_textattr(int newattr);
  182. __extern void caca_conio_textbackground(int newcolor);
  183. __extern void caca_conio_textcolor(int newcolor);
  184. __extern void caca_conio_textmode(int newmode);
  185. __extern int caca_conio_ungetch(int ch);
  186. __extern int caca_conio_wherex(void);
  187. __extern int caca_conio_wherey(void);
  188. __extern void caca_conio_window(int left, int top, int right, int bottom);
  189. #if !defined _DOXYGEN_SKIP_ME && !defined __LIBCACA__
  190. # undef cgets
  191. # define cgets caca_conio_cgets
  192. # undef clreol
  193. # define clreol caca_conio_clreol
  194. # undef clrscr
  195. # define clrscr caca_conio_clrscr
  196. # undef cprintf
  197. # define cprintf caca_conio_cprintf
  198. # undef cputs
  199. # define cputs caca_conio_cputs
  200. # undef cscanf
  201. # define cscanf caca_conio_cscanf
  202. # undef delay
  203. # define delay caca_conio_delay
  204. # undef delline
  205. # define delline caca_conio_delline
  206. # undef getch
  207. # define getch caca_conio_getch
  208. # undef getche
  209. # define getche caca_conio_getche
  210. # undef getpass
  211. # define getpass caca_conio_getpass
  212. # undef gettext
  213. # define gettext caca_conio_gettext
  214. # undef gettextinfo
  215. # define gettextinfo caca_conio_gettextinfo
  216. # undef gotoxy
  217. # define gotoxy caca_conio_gotoxy
  218. # undef highvideo
  219. # define highvideo caca_conio_highvideo
  220. # undef insline
  221. # define insline caca_conio_insline
  222. # undef kbhit
  223. # define kbhit caca_conio_kbhit
  224. # undef lowvideo
  225. # define lowvideo caca_conio_lowvideo
  226. # undef movetext
  227. # define movetext caca_conio_movetext
  228. # undef normvideo
  229. # define normvideo caca_conio_normvideo
  230. # undef nosound
  231. # define nosound caca_conio_nosound
  232. # undef printf
  233. # define printf caca_conio_printf
  234. # undef putch
  235. # define putch caca_conio_putch
  236. # undef puttext
  237. # define puttext caca_conio_puttext
  238. # undef _setcursortype
  239. # define _setcursortype caca_conio__setcursortype
  240. # undef sleep
  241. # define sleep caca_conio_sleep
  242. # undef sound
  243. # define sound caca_conio_sound
  244. # undef textattr
  245. # define textattr caca_conio_textattr
  246. # undef textbackground
  247. # define textbackground caca_conio_textbackground
  248. # undef textcolor
  249. # define textcolor caca_conio_textcolor
  250. # undef textmode
  251. # define textmode caca_conio_textmode
  252. # undef ungetch
  253. # define ungetch caca_conio_ungetch
  254. # undef wherex
  255. # define wherex caca_conio_wherex
  256. # undef wherey
  257. # define wherey caca_conio_wherey
  258. # undef window
  259. # define window caca_conio_window
  260. #endif
  261. #ifdef __cplusplus
  262. }
  263. #endif
  264. #endif /* __CACA_CONIO_H__ */