Changeset 3603


Ignore:
Timestamp:
08/02/09 13:09:16 (4 years ago)
Author:
sam
Message:

Move conio functions to the main caca.h header, with their caca_conio_
prefix. The #defines remain in caca_conio.h.

Location:
libcaca/trunk/caca
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/caca.h

    r3587 r3603  
    2929#if !defined(__KERNEL__) 
    3030#   include <stdarg.h> 
     31#   include <stdio.h> 
    3132#endif 
    3233 
     
    492493__extern int caca_get_event_resize_width(caca_event_t const *); 
    493494__extern int caca_get_event_resize_height(caca_event_t const *); 
     495/*  @} */ 
     496 
     497/** \brief DOS colours 
     498 * 
     499 *  This enum lists the colour values for the DOS conio.h compatibility 
     500 *  layer. 
     501 */ 
     502enum CACA_CONIO_COLORS 
     503{ 
     504    CACA_CONIO_BLINK = 128, 
     505    CACA_CONIO_BLACK = 0, 
     506    CACA_CONIO_BLUE = 1, 
     507    CACA_CONIO_GREEN = 2, 
     508    CACA_CONIO_CYAN = 3, 
     509    CACA_CONIO_RED = 4, 
     510    CACA_CONIO_MAGENTA = 5, 
     511    CACA_CONIO_BROWN = 6, 
     512    CACA_CONIO_LIGHTGRAY = 7, 
     513    CACA_CONIO_DARKGRAY = 8, 
     514    CACA_CONIO_LIGHTBLUE = 9, 
     515    CACA_CONIO_LIGHTGREEN = 10, 
     516    CACA_CONIO_LIGHTCYAN = 11, 
     517    CACA_CONIO_LIGHTRED = 12, 
     518    CACA_CONIO_LIGHTMAGENTA = 13, 
     519    CACA_CONIO_YELLOW = 14, 
     520    CACA_CONIO_WHITE = 15, 
     521}; 
     522 
     523/** \brief DOS cursor modes 
     524 * 
     525 *  This enum lists the cursor mode values for the DOS conio.h compatibility 
     526 *  layer. 
     527 */ 
     528enum CACA_CONIO_CURSOR 
     529{ 
     530    CACA_CONIO__NOCURSOR = 0, 
     531    CACA_CONIO__SOLIDCURSOR = 1, 
     532    CACA_CONIO__NORMALCURSOR = 2, 
     533}; 
     534 
     535/** \brief DOS video modes 
     536 * 
     537 *  This enum lists the video mode values for the DOS conio.h compatibility 
     538 *  layer. 
     539 */ 
     540enum CACA_CONIO_MODE 
     541{ 
     542    CACA_CONIO_LASTMODE = -1, 
     543    CACA_CONIO_BW40 = 0, 
     544    CACA_CONIO_C40 = 1, 
     545    CACA_CONIO_BW80 = 2, 
     546    CACA_CONIO_C80 = 3, 
     547    CACA_CONIO_MONO = 7, 
     548    CACA_CONIO_C4350 = 64, 
     549}; 
     550 
     551/** \brief DOS text area information 
     552 * 
     553 *  This structure stores text area information for the DOS conio.h 
     554 *  compatibility layer. 
     555 */ 
     556struct caca_conio_text_info 
     557{ 
     558    unsigned char winleft;        /* left window coordinate */ 
     559    unsigned char wintop;         /* top window coordinate */ 
     560    unsigned char winright;       /* right window coordinate */ 
     561    unsigned char winbottom;      /* bottom window coordinate */ 
     562    unsigned char attribute;      /* text attribute */ 
     563    unsigned char normattr;       /* normal attribute */ 
     564    unsigned char currmode;       /* current video mode: 
     565                                     BW40, BW80, C40, C80, or C4350 */ 
     566    unsigned char screenheight;   /* text screen's height */ 
     567    unsigned char screenwidth;    /* text screen's width */ 
     568    unsigned char curx;           /* x-coordinate in current window */ 
     569    unsigned char cury;           /* y-coordinate in current window */ 
     570}; 
     571 
     572/** \brief DOS direct video control */ 
     573__extern int caca_conio_directvideo; 
     574 
     575/** \brief DOS scrolling control */ 
     576__extern int caca_conio__wscroll; 
     577 
     578/** \defgroup conio libcaca DOS conio.h compatibility layer 
     579 * 
     580 *  These functions implement DOS-like functions for high-level text 
     581 *  operations. 
     582 * 
     583 *  @{ */ 
     584__extern char * caca_conio_cgets(char *str); 
     585__extern void   caca_conio_clreol(void); 
     586__extern void   caca_conio_clrscr(void); 
     587__extern int    caca_conio_cprintf(const char *format, ...); 
     588__extern int    caca_conio_cputs(const char *str); 
     589__extern int    caca_conio_cscanf(char *format, ...); 
     590__extern void   caca_conio_delay(unsigned int); 
     591__extern void   caca_conio_delline(void); 
     592__extern int    caca_conio_getch(void); 
     593__extern int    caca_conio_getche(void); 
     594__extern char * caca_conio_getpass(const char *prompt); 
     595__extern int    caca_conio_gettext(int left, int top, int right, int bottom, 
     596                                   void *destin); 
     597__extern void   caca_conio_gettextinfo(struct caca_conio_text_info *r); 
     598__extern void   caca_conio_gotoxy(int x, int y); 
     599__extern void   caca_conio_highvideo(void); 
     600__extern void   caca_conio_insline(void); 
     601__extern int    caca_conio_kbhit(void); 
     602__extern void   caca_conio_lowvideo(void); 
     603__extern int    caca_conio_movetext(int left, int top, int right, int bottom, 
     604                                    int destleft, int desttop); 
     605__extern void   caca_conio_normvideo(void); 
     606__extern void   caca_conio_nosound(void); 
     607__extern int    caca_conio_printf(const char *format, ...); 
     608__extern int    caca_conio_putch(int ch); 
     609__extern int    caca_conio_puttext(int left, int top, int right, int bottom, 
     610                                   void *destin); 
     611__extern void   caca_conio__setcursortype(int cur_t); 
     612__extern void   caca_conio_sleep(unsigned int); 
     613__extern void   caca_conio_sound(unsigned int); 
     614__extern void   caca_conio_textattr(int newattr); 
     615__extern void   caca_conio_textbackground(int newcolor); 
     616__extern void   caca_conio_textcolor(int newcolor); 
     617__extern void   caca_conio_textmode(int newmode); 
     618__extern int    caca_conio_ungetch(int ch); 
     619__extern int    caca_conio_wherex(void); 
     620__extern int    caca_conio_wherey(void); 
     621__extern void   caca_conio_window(int left, int top, int right, int bottom); 
    494622/*  @} */ 
    495623 
  • libcaca/trunk/caca/caca_conio.h

    r3601 r3603  
    2121 
    2222#include <caca.h> 
    23  
    24 #if !defined(__KERNEL__) 
    25 #   include <stdio.h> 
    26 #endif 
    27  
    28 #undef __extern 
    29 #if defined(_DOXYGEN_SKIP_ME) 
    30 #elif defined(_WIN32) && defined(__LIBCACA__) 
    31 #   define __extern extern __declspec(dllexport) 
    32 #else 
    33 #   define __extern extern 
    34 #endif 
    35  
    36 #ifdef __cplusplus 
    37 extern "C" 
    38 { 
    39 #endif 
    40  
    41 /* conio.h enums and global variables */ 
    42 enum CACA_CONIO_COLORS 
    43 { 
    44     CACA_CONIO_BLINK = 128, 
    45     CACA_CONIO_BLACK = 0, 
    46     CACA_CONIO_BLUE = 1, 
    47     CACA_CONIO_GREEN = 2, 
    48     CACA_CONIO_CYAN = 3, 
    49     CACA_CONIO_RED = 4, 
    50     CACA_CONIO_MAGENTA = 5, 
    51     CACA_CONIO_BROWN = 6, 
    52     CACA_CONIO_LIGHTGRAY = 7, 
    53     CACA_CONIO_DARKGRAY = 8, 
    54     CACA_CONIO_LIGHTBLUE = 9, 
    55     CACA_CONIO_LIGHTGREEN = 10, 
    56     CACA_CONIO_LIGHTCYAN = 11, 
    57     CACA_CONIO_LIGHTRED = 12, 
    58     CACA_CONIO_LIGHTMAGENTA = 13, 
    59     CACA_CONIO_YELLOW = 14, 
    60     CACA_CONIO_WHITE = 15, 
    61 }; 
    62 __extern int caca_conio_directvideo; 
    63 enum CACA_CONIO_CURSOR 
    64 { 
    65     CACA_CONIO__NOCURSOR = 0, 
    66     CACA_CONIO__SOLIDCURSOR = 1, 
    67     CACA_CONIO__NORMALCURSOR = 2, 
    68 }; 
    69 struct caca_conio_text_info 
    70 { 
    71     unsigned char winleft;        /* left window coordinate */ 
    72     unsigned char wintop;         /* top window coordinate */ 
    73     unsigned char winright;       /* right window coordinate */ 
    74     unsigned char winbottom;      /* bottom window coordinate */ 
    75     unsigned char attribute;      /* text attribute */ 
    76     unsigned char normattr;       /* normal attribute */ 
    77     unsigned char currmode;       /* current video mode: 
    78                                      BW40, BW80, C40, C80, or C4350 */ 
    79     unsigned char screenheight;   /* text screen's height */ 
    80     unsigned char screenwidth;    /* text screen's width */ 
    81     unsigned char curx;           /* x-coordinate in current window */ 
    82     unsigned char cury;           /* y-coordinate in current window */ 
    83 }; 
    84 enum CACA_CONIO_MODE 
    85 { 
    86     CACA_CONIO_LASTMODE = -1, 
    87     CACA_CONIO_BW40 = 0, 
    88     CACA_CONIO_C40 = 1, 
    89     CACA_CONIO_BW80 = 2, 
    90     CACA_CONIO_C80 = 3, 
    91     CACA_CONIO_MONO = 7, 
    92     CACA_CONIO_C4350 = 64, 
    93 }; 
    94 __extern int caca_conio__wscroll; 
    9523 
    9624#if !defined _DOXYGEN_SKIP_ME && !defined __LIBCACA__ 
     
    12957#   undef WHITE 
    13058#   define WHITE CACA_CONIO_WHITE 
    131 #   undef directvideo 
    132 #   define directvideo caca_conio_directvideo 
     59#endif 
     60 
     61#if !defined _DOXYGEN_SKIP_ME && !defined __LIBCACA__ 
    13362#   undef _NOCURSOR 
    13463#   define _NOCURSOR CACA_CONIO__NOCURSOR 
     
    13766#   undef _NORMALCURSOR 
    13867#   define _NORMALCURSOR CACA_CONIO__NORMALCURSOR 
    139 #   undef text_info 
    140 #   define text_info caca_conio_text_info 
     68#endif 
     69 
     70#if !defined _DOXYGEN_SKIP_ME && !defined __LIBCACA__ 
    14171#   undef LASTMODE 
    14272#   define LASTMODE CACA_CONIO_LASTMODE 
     
    15383#   undef C4350 
    15484#   define C4350 CACA_CONIO_C4350 
     85#endif 
     86 
     87#if !defined _DOXYGEN_SKIP_ME && !defined __LIBCACA__ 
     88#   undef directvideo 
     89#   define directvideo caca_conio_directvideo 
     90#   undef text_info 
     91#   define text_info caca_conio_text_info 
    15592#   undef _wscroll 
    15693#   define _wscroll caca_conio__wscroll 
    15794#endif 
    158  
    159 /* conio.h functions */ 
    160 __extern char * caca_conio_cgets(char *str); 
    161 __extern void   caca_conio_clreol(void); 
    162 __extern void   caca_conio_clrscr(void); 
    163 __extern int    caca_conio_cprintf(const char *format, ...); 
    164 __extern int    caca_conio_cputs(const char *str); 
    165 __extern int    caca_conio_cscanf(char *format, ...); 
    166 __extern void   caca_conio_delay(unsigned int); 
    167 __extern void   caca_conio_delline(void); 
    168 __extern int    caca_conio_getch(void); 
    169 __extern int    caca_conio_getche(void); 
    170 __extern char * caca_conio_getpass(const char *prompt); 
    171 __extern int    caca_conio_gettext(int left, int top, int right, int bottom, 
    172                                    void *destin); 
    173 __extern void   caca_conio_gettextinfo(struct caca_conio_text_info *r); 
    174 __extern void   caca_conio_gotoxy(int x, int y); 
    175 __extern void   caca_conio_highvideo(void); 
    176 __extern void   caca_conio_insline(void); 
    177 __extern int    caca_conio_kbhit(void); 
    178 __extern void   caca_conio_lowvideo(void); 
    179 __extern int    caca_conio_movetext(int left, int top, int right, int bottom, 
    180                                     int destleft, int desttop); 
    181 __extern void   caca_conio_normvideo(void); 
    182 __extern void   caca_conio_nosound(void); 
    183 __extern int    caca_conio_printf(const char *format, ...); 
    184 __extern int    caca_conio_putch(int ch); 
    185 __extern int    caca_conio_puttext(int left, int top, int right, int bottom, 
    186                                    void *destin); 
    187 __extern void   caca_conio__setcursortype(int cur_t); 
    188 __extern void   caca_conio_sleep(unsigned int); 
    189 __extern void   caca_conio_sound(unsigned int); 
    190 __extern void   caca_conio_textattr(int newattr); 
    191 __extern void   caca_conio_textbackground(int newcolor); 
    192 __extern void   caca_conio_textcolor(int newcolor); 
    193 __extern void   caca_conio_textmode(int newmode); 
    194 __extern int    caca_conio_ungetch(int ch); 
    195 __extern int    caca_conio_wherex(void); 
    196 __extern int    caca_conio_wherey(void); 
    197 __extern void   caca_conio_window(int left, int top, int right, int bottom); 
    19895 
    19996#if !defined _DOXYGEN_SKIP_ME && !defined __LIBCACA__ 
     
    270167#endif 
    271168 
    272 #ifdef __cplusplus 
    273 } 
    274 #endif 
    275  
    276169#endif /* __CACA_CONIO_H__ */ 
Note: See TracChangeset for help on using the changeset viewer.