Annotation of sbbs/conio/ciolib.h, revision 1.1.1.1

1.1       root        1: /* $Id: ciolib.h,v 1.20 2004/10/17 02:07:04 deuce Exp $ */
                      2: 
                      3: /****************************************************************************
                      4:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
                      5:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
                      6:  *                                                                                                                                                     *
                      7:  * Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html         *
                      8:  *                                                                                                                                                     *
                      9:  * This library is free software; you can redistribute it and/or                       *
                     10:  * modify it under the terms of the GNU Lesser General Public License          *
                     11:  * as published by the Free Software Foundation; either version 2                      *
                     12:  * of the License, or (at your option) any later version.                                      *
                     13:  * See the GNU Lesser General Public License for more details: lgpl.txt or     *
                     14:  * http://www.fsf.org/copyleft/lesser.html                                                                     *
                     15:  *                                                                                                                                                     *
                     16:  * Anonymous FTP access to the most recent released source is available at     *
                     17:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
                     18:  *                                                                                                                                                     *
                     19:  * Anonymous CVS access to the development source and modification history     *
                     20:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
                     21:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
                     22:  *     (just hit return, no password is necessary)                                                     *
                     23:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
                     24:  *                                                                                                                                                     *
                     25:  * For Synchronet coding style and modification guidelines, see                                *
                     26:  * http://www.synchro.net/source.html                                                                          *
                     27:  *                                                                                                                                                     *
                     28:  * You are encouraged to submit any modifications (preferably in Unix diff     *
                     29:  * format) via e-mail to [email protected]                                                                      *
                     30:  *                                                                                                                                                     *
                     31:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
                     32:  ****************************************************************************/
                     33: 
                     34: #ifndef _CIOLIB_H_
                     35: #define _CIOLIB_H_
                     36: 
                     37: #include "mouse.h"
                     38: 
                     39: enum {
                     40:         CIOLIB_MODE_AUTO
                     41:        ,CIOLIB_MODE_CURSES
                     42:        ,CIOLIB_MODE_CURSES_IBM
                     43:        ,CIOLIB_MODE_ANSI
                     44:        ,CIOLIB_MODE_X
                     45:        ,CIOLIB_MODE_CONIO
                     46: };
                     47: 
                     48: #if defined(_WIN32)    /* presumably, Win32 */
                     49: 
                     50:        #include <io.h>                 /* isatty */
                     51: 
                     52: #endif
                     53: 
                     54: enum {
                     55:         BLACK
                     56:        ,BLUE
                     57:        ,GREEN
                     58:        ,CYAN
                     59:        ,RED
                     60:        ,MAGENTA
                     61:        ,BROWN  
                     62:        ,LIGHTGRAY      
                     63:        ,DARKGRAY
                     64:        ,LIGHTBLUE      
                     65:        ,LIGHTGREEN     
                     66:        ,LIGHTCYAN
                     67:        ,LIGHTRED
                     68:        ,LIGHTMAGENTA
                     69:        ,YELLOW
                     70:        ,WHITE
                     71: };
                     72: #define BLINK 128
                     73: 
                     74: enum text_modes
                     75: {
                     76:     /* DOS-compatible modes */
                     77: 
                     78:     LASTMODE = -1,
                     79:     BW40     = 0,
                     80:     C40,
                     81:     BW80,
                     82:     C80,
                     83:     MONO     = 7,
                     84: 
                     85:     /* New Color modes */
                     86: 
                     87:     C40X14   = 8,
                     88:     C40X21,
                     89:     C40X28,
                     90:     C40X43,
                     91:     C40X50,
                     92:     C40X60,
                     93: 
                     94:     C80X14,
                     95:     C80X21,
                     96:     C80X28,
                     97:     C80X43,
                     98:     C80X50,
                     99:     C80X60,
                    100: 
                    101:     /* New Black & White modes */
                    102: 
                    103:     BW40X14,
                    104:     BW40X21,
                    105:     BW40X28,
                    106:     BW40X43,
                    107:     BW40X50,
                    108:     BW40X60,
                    109: 
                    110:     BW80X14,
                    111:     BW80X21,
                    112:     BW80X28,
                    113:     BW80X43,
                    114:     BW80X50,
                    115:     BW80X60,
                    116: 
                    117:     /* New Monochrome modes */
                    118: 
                    119:     MONO14,             /* Invalid VGA mode */
                    120:     MONO21,
                    121:     MONO28,
                    122:     MONO43,
                    123:     MONO50,
                    124:     MONO60,
                    125: 
                    126:     C4350    = C80X50, /* this is actually "64" in the "real" conio */
                    127: 
                    128:     _ORIGMODE = 65      /* original mode at program startup */
                    129: };
                    130: 
                    131: #define COLOR_MODE     C80
                    132: 
                    133: enum
                    134: {
                    135:        _NOCURSOR,
                    136:        _SOLIDCURSOR,
                    137:        _NORMALCURSOR
                    138: };
                    139: 
                    140: struct text_info {
                    141:        unsigned char winleft;        /* left window coordinate */
                    142:        unsigned char wintop;         /* top window coordinate */
                    143:        unsigned char winright;       /* right window coordinate */
                    144:        unsigned char winbottom;      /* bottom window coordinate */
                    145:        unsigned char attribute;      /* text attribute */
                    146:        unsigned char normattr;       /* normal attribute */
                    147:        unsigned char currmode;       /* current video mode:
                    148:                                         BW40, BW80, C40, C80, or C4350 */
                    149:        unsigned char screenheight;   /* text screen's height */
                    150:        unsigned char screenwidth;    /* text screen's width */
                    151:        unsigned char curx;           /* x-coordinate in current window */
                    152:        unsigned char cury;           /* y-coordinate in current window */
                    153: };
                    154: 
                    155: typedef struct {
                    156:        int             mode;
                    157:        int             mouse;
                    158:        void    (*clreol)               (void);
                    159:        int             (*puttext)              (int,int,int,int,void *);
                    160:        int             (*gettext)              (int,int,int,int,void *);
                    161:        void    (*textattr)             (int);
                    162:        int             (*kbhit)                (void);
                    163:        void    (*delay)                (long);
                    164:        int             (*wherex)               (void);
                    165:        int             (*wherey)               (void);
                    166:        int             (*putch)                (int);
                    167:        void    (*gotoxy)               (int,int);
                    168:        void    (*clrscr)               (void);
                    169:        void    (*gettextinfo)  (struct text_info *);
                    170:        void    (*setcursortype)(int);
                    171:        int             (*getch)                (void);
                    172:        int             (*getche)               (void);
                    173:        int             (*beep)                 (void);
                    174:        void    (*highvideo)    (void);
                    175:        void    (*lowvideo)             (void);
                    176:        void    (*normvideo)    (void);
                    177:        void    (*textmode)             (int);
                    178:        int             (*ungetch)              (int);
                    179:        int             (*movetext)             (int,int,int,int,int,int);
                    180:        char    *(*cgets)               (char *);
                    181:        int             (*cscanf)               (char *,...);
                    182:        char    *(*getpass)             (const char *);
                    183:        void    (*wscroll)              (void);
                    184:        void    (*window)               (int,int,int,int);
                    185:        void    (*delline)              (void);
                    186:        void    (*insline)              (void);
                    187:        int             (*cprintf)              (char *,...);
                    188:        int             (*cputs)                (char *);
                    189:        void    (*textbackground)       (int);
                    190:        void    (*textcolor)    (int);
                    191:        int             (*getmouse)             (struct mouse_event *mevent);
                    192:        int             (*ungetmouse)   (struct mouse_event *mevent);
                    193:        int             (*hidemouse)    (void);
                    194:        int             (*showmouse)    (void);
                    195:        void    (*settitle)             (const char *);
                    196: } cioapi_t;
                    197: 
                    198: extern cioapi_t cio_api;
                    199: extern int _wscroll;
                    200: extern int directvideo;
                    201: extern int dont_move_cursor;
                    202: 
                    203: #define _conio_kbhit()         kbhit()
                    204: 
                    205: #ifdef __cplusplus
                    206: extern "C" {
                    207: #endif
                    208: int initciolib(int mode);
                    209: 
                    210: int ciolib_movetext(int sx, int sy, int ex, int ey, int dx, int dy);
                    211: char *ciolib_cgets(char *str);
                    212: int ciolib_cscanf (char *format , ...);
                    213: int ciolib_kbhit(void);
                    214: int ciolib_getch(void);
                    215: int ciolib_getche(void);
                    216: int ciolib_ungetch(int ch);
                    217: void ciolib_gettextinfo(struct text_info *info);
                    218: int ciolib_wherex(void);
                    219: int ciolib_wherey(void);
                    220: void ciolib_wscroll(void);
                    221: void ciolib_gotoxy(int x, int y);
                    222: void ciolib_clreol(void);
                    223: void ciolib_clrscr(void);
                    224: int ciolib_cputs(char *str);
                    225: int    ciolib_cprintf(char *fmat, ...);
                    226: void ciolib_textbackground(int colour);
                    227: void ciolib_textcolor(int colour);
                    228: void ciolib_highvideo(void);
                    229: void ciolib_lowvideo(void);
                    230: void ciolib_normvideo(void);
                    231: int ciolib_puttext(int a,int b,int c,int d,unsigned char *e);
                    232: int ciolib_gettext(int a,int b,int c,int d,unsigned char *e);
                    233: void ciolib_textattr(int a);
                    234: void ciolib_delay(long a);
                    235: int ciolib_putch(int a);
                    236: void ciolib_setcursortype(int a);
                    237: void ciolib_textmode(int mode);
                    238: void ciolib_window(int sx, int sy, int ex, int ey);
                    239: void ciolib_delline(void);
                    240: void ciolib_insline(void);
                    241: char *ciolib_getpass(const char *prompt);
                    242: void settitle(const char *title);
                    243: int ciolib_showmouse(void);
                    244: int ciolib_hidemouse(void);
                    245: void ciolib_settitle(const char *title);
                    246: #ifdef __cplusplus
                    247: }
                    248: #endif
                    249: 
                    250: #ifndef CIOLIB_NO_MACROS
                    251:        #define cscanf                                  ciolib_cscanf
                    252:        #define cprintf                                 ciolib_cprintf
                    253: 
                    254:        #define movetext(a,b,c,d,e,f)   ciolib_movetext(a,b,c,d,e,f)
                    255:        #define cgets(a)                                ciolib_cgets(a)
                    256:        #define kbhit()                                 ciolib_kbhit()
                    257:        #define getch()                                 ciolib_getch()
                    258:        #define getche()                                ciolib_getche()
                    259:        #define ungetch(a)                              ciolib_ungetch(a)
                    260:        #define gettextinfo(a)                  ciolib_gettextinfo(a)
                    261:        #define wherex()                                ciolib_wherex()
                    262:        #define wherey()                                ciolib_wherey()
                    263:        #define wscroll()                               ciolib_wscroll()
                    264:        #define gotoxy(a,b)                             ciolib_gotoxy(a,b)
                    265:        #define clreol()                                ciolib_clreol()
                    266:        #define clrscr()                                ciolib_clrscr()
                    267:        #define cputs(a)                                ciolib_cputs(a)
                    268:        #define textbackground(a)               ciolib_textbackground(a)
                    269:        #define textcolor(a)                    ciolib_textcolor(a)
                    270:        #define highvideo()                             ciolib_highvideo()
                    271:        #define lowvideo()                              ciolib_lowvideo()
                    272:        #define normvideo()                             ciolib_normvideo()
                    273:        #define puttext(a,b,c,d,e)              ciolib_puttext(a,b,c,d,e)
                    274:        #define gettext(a,b,c,d,e)              ciolib_gettext(a,b,c,d,e)
                    275:        #define textattr(a)                             ciolib_textattr(a)
                    276:        #define delay(a)                                ciolib_delay(a)
                    277:        #define putch(a)                                ciolib_putch(a)
                    278:        #define _setcursortype(a)               ciolib_setcursortype(a)
                    279:        #define textmode(a)                             ciolib_textmode(a)
                    280:        #define window(a,b,c,d)                 ciolib_window(a,b,c,d)
                    281:        #define delline()                               ciolib_delline()
                    282:        #define insline()                               ciolib_insline()
                    283:        #define getpass(a)                              ciolib_getpass(a)
                    284:        #define getmouse(a)                             ciolib_getmouse(a)
                    285:        #define ungetmouse(a)                   ciolib_ungetmouse(a)
                    286:        #define hidemouse()                             ciolib_hidemouse()
                    287:        #define showmouse()                             ciolib_showmouse()
                    288:        #define settitle(a)                             ciolib_settitle(a)
                    289: #endif
                    290: 
                    291: #endif /* Do not add anything after this line */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.