25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

265 satır
8.1 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 defines and global variables */
  35. #define CACA_CONIO_BLINK 128
  36. #define CACA_CONIO_BLACK 0
  37. #define CACA_CONIO_BLUE 1
  38. #define CACA_CONIO_GREEN 2
  39. #define CACA_CONIO_CYAN 3
  40. #define CACA_CONIO_RED 4
  41. #define CACA_CONIO_MAGENTA 5
  42. #define CACA_CONIO_BROWN 6
  43. #define CACA_CONIO_LIGHTGRAY 7
  44. #define CACA_CONIO_DARKGRAY 8
  45. #define CACA_CONIO_LIGHTBLUE 9
  46. #define CACA_CONIO_LIGHTGREEN 10
  47. #define CACA_CONIO_LIGHTCYAN 11
  48. #define CACA_CONIO_LIGHTRED 12
  49. #define CACA_CONIO_LIGHTMAGENTA 13
  50. #define CACA_CONIO_YELLOW 14
  51. #define CACA_CONIO_WHITE 15
  52. __extern int caca_conio_directvideo;
  53. #define CACA_CONIO__NOCURSOR 0
  54. #define CACA_CONIO__SOLIDCURSOR 1
  55. #define CACA_CONIO__NORMALCURSOR 2
  56. struct caca_conio_text_info
  57. {
  58. unsigned char winleft; /* left window coordinate */
  59. unsigned char wintop; /* top window coordinate */
  60. unsigned char winright; /* right window coordinate */
  61. unsigned char winbottom; /* bottom window coordinate */
  62. unsigned char attribute; /* text attribute */
  63. unsigned char normattr; /* normal attribute */
  64. unsigned char currmode; /* current video mode:
  65. BW40, BW80, C40, C80, or C4350 */
  66. unsigned char screenheight; /* text screen's height */
  67. unsigned char screenwidth; /* text screen's width */
  68. unsigned char curx; /* x-coordinate in current window */
  69. unsigned char cury; /* y-coordinate in current window */
  70. };
  71. #define CACA_CONIO_LASTMODE -1
  72. #define CACA_CONIO_BW40 0
  73. #define CACA_CONIO_C40 1
  74. #define CACA_CONIO_BW80 2
  75. #define CACA_CONIO_C80 3
  76. #define CACA_CONIO_MONO 7
  77. #define CACA_CONIO_C4350 64
  78. __extern int caca_conio__wscroll;
  79. #if !defined _DOXYGEN_SKIP_ME && !defined __LIBCACA__
  80. # undef BLINK
  81. # define BLINK CACA_CONIO_BLINK
  82. # undef BLACK
  83. # define BLACK CACA_CONIO_BLACK
  84. # undef BLUE
  85. # define BLUE CACA_CONIO_BLUE
  86. # undef GREEN
  87. # define GREEN CACA_CONIO_GREEN
  88. # undef CYAN
  89. # define CYAN CACA_CONIO_CYAN
  90. # undef RED
  91. # define RED CACA_CONIO_RED
  92. # undef MAGENTA
  93. # define MAGENTA CACA_CONIO_MAGENTA
  94. # undef BROWN
  95. # define BROWN CACA_CONIO_BROWN
  96. # undef LIGHTGRAY
  97. # define LIGHTGRAY CACA_CONIO_LIGHTGRAY
  98. # undef DARKGRAY
  99. # define DARKGRAY CACA_CONIO_DARKGRAY
  100. # undef LIGHTBLUE
  101. # define LIGHTBLUE CACA_CONIO_LIGHTBLUE
  102. # undef LIGHTGREEN
  103. # define LIGHTGREEN CACA_CONIO_LIGHTGREEN
  104. # undef LIGHTCYAN
  105. # define LIGHTCYAN CACA_CONIO_LIGHTCYAN
  106. # undef LIGHTRED
  107. # define LIGHTRED CACA_CONIO_LIGHTRED
  108. # undef LIGHTMAGENTA
  109. # define LIGHTMAGENTA CACA_CONIO_LIGHTMAGENTA
  110. # undef YELLOW
  111. # define YELLOW CACA_CONIO_YELLOW
  112. # undef WHITE
  113. # define WHITE CACA_CONIO_WHITE
  114. # undef directvideo
  115. # define directvideo caca_conio_directvideo
  116. # undef _NOCURSOR
  117. # define _NOCURSOR CACA_CONIO__NOCURSOR
  118. # undef _SOLIDCURSOR
  119. # define _SOLIDCURSOR CACA_CONIO__SOLIDCURSOR
  120. # undef _NORMALCURSOR
  121. # define _NORMALCURSOR CACA_CONIO__NORMALCURSOR
  122. # undef text_info
  123. # define text_info caca_conio_text_info
  124. # undef LASTMODE
  125. # define LASTMODE CACA_CONIO_LASTMODE
  126. # undef BW40
  127. # define BW40 CACA_CONIO_BW40
  128. # undef C40
  129. # define C40 CACA_CONIO_C40
  130. # undef BW80
  131. # define BW80 CACA_CONIO_BW80
  132. # undef C80
  133. # define C80 CACA_CONIO_C80
  134. # undef MONO
  135. # define MONO CACA_CONIO_MONO
  136. # undef C4350
  137. # define C4350 CACA_CONIO_C4350
  138. # undef _wscroll
  139. # define _wscroll caca_conio__wscroll
  140. #endif
  141. /* conio.h functions */
  142. __extern char * caca_conio_cgets(char *str);
  143. __extern void caca_conio_clreol(void);
  144. __extern void caca_conio_clrscr(void);
  145. __extern int caca_conio_cprintf(const char *format, ...);
  146. __extern int caca_conio_cputs(const char *str);
  147. __extern int caca_conio_cscanf(char *format, ...);
  148. __extern void caca_conio_delay(int);
  149. __extern void caca_conio_delline(void);
  150. __extern int caca_conio_getch(void);
  151. __extern int caca_conio_getche(void);
  152. __extern char * caca_conio_getpass(const char *prompt);
  153. __extern int caca_conio_gettext(int left, int top, int right, int bottom,
  154. void *destin);
  155. __extern void caca_conio_gettextinfo(struct caca_conio_text_info *r);
  156. __extern void caca_conio_gotoxy(int x, int y);
  157. __extern void caca_conio_highvideo(void);
  158. __extern void caca_conio_insline(void);
  159. __extern int caca_conio_kbhit(void);
  160. __extern void caca_conio_lowvideo(void);
  161. __extern int caca_conio_movetext(int left, int top, int right, int bottom,
  162. int destleft, int desttop);
  163. __extern void caca_conio_normvideo(void);
  164. __extern void caca_conio_nosound(void);
  165. __extern int caca_conio_printf(const char *format, ...);
  166. __extern int caca_conio_putch(int ch);
  167. __extern int caca_conio_puttext(int left, int top, int right, int bottom,
  168. void *destin);
  169. __extern void caca_conio__setcursortype(int cur_t);
  170. __extern void caca_conio_sound(int);
  171. __extern void caca_conio_textattr(int newattr);
  172. __extern void caca_conio_textbackground(int newcolor);
  173. __extern void caca_conio_textcolor(int newcolor);
  174. __extern void caca_conio_textmode(int newmode);
  175. __extern int caca_conio_ungetch(int ch);
  176. __extern int caca_conio_wherex(void);
  177. __extern int caca_conio_wherey(void);
  178. __extern void caca_conio_window(int left, int top, int right, int bottom);
  179. #if !defined _DOXYGEN_SKIP_ME && !defined __LIBCACA__
  180. # undef cgets
  181. # define cgets caca_conio_cgets
  182. # undef clreol
  183. # define clreol caca_conio_clreol
  184. # undef clrscr
  185. # define clrscr caca_conio_clrscr
  186. # undef cprintf
  187. # define cprintf caca_conio_cprintf
  188. # undef cputs
  189. # define cputs caca_conio_cputs
  190. # undef cscanf
  191. # define cscanf caca_conio_cscanf
  192. # undef delay
  193. # define delay caca_conio_delay
  194. # undef delline
  195. # define delline caca_conio_delline
  196. # undef getch
  197. # define getch caca_conio_getch
  198. # undef getche
  199. # define getche caca_conio_getche
  200. # undef getpass
  201. # define getpass caca_conio_getpass
  202. # undef gettext
  203. # define gettext caca_conio_gettext
  204. # undef gettextinfo
  205. # define gettextinfo caca_conio_gettextinfo
  206. # undef gotoxy
  207. # define gotoxy caca_conio_gotoxy
  208. # undef highvideo
  209. # define highvideo caca_conio_highvideo
  210. # undef insline
  211. # define insline caca_conio_insline
  212. # undef kbhit
  213. # define kbhit caca_conio_kbhit
  214. # undef lowvideo
  215. # define lowvideo caca_conio_lowvideo
  216. # undef movetext
  217. # define movetext caca_conio_movetext
  218. # undef normvideo
  219. # define normvideo caca_conio_normvideo
  220. # undef nosound
  221. # define nosound caca_conio_nosound
  222. # undef printf
  223. # define printf caca_conio_printf
  224. # undef putch
  225. # define putch caca_conio_putch
  226. # undef puttext
  227. # define puttext caca_conio_puttext
  228. # undef _setcursortype
  229. # define _setcursortype caca_conio__setcursortype
  230. # undef sound
  231. # define sound caca_conio_sound
  232. # undef textattr
  233. # define textattr caca_conio_textattr
  234. # undef textbackground
  235. # define textbackground caca_conio_textbackground
  236. # undef textcolor
  237. # define textcolor caca_conio_textcolor
  238. # undef textmode
  239. # define textmode caca_conio_textmode
  240. # undef ungetch
  241. # define ungetch caca_conio_ungetch
  242. # undef wherex
  243. # define wherex caca_conio_wherex
  244. # undef wherey
  245. # define wherey caca_conio_wherey
  246. # undef window
  247. # define window caca_conio_window
  248. #endif
  249. #ifdef __cplusplus
  250. }
  251. #endif
  252. #endif /* __CACA_CONIO_H__ */