|
|
1.1 ! root 1: /* $Id: ciolib.h,v 1.38 2006/05/28 21:43:23 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 2005 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 <string.h> /* size_t */ ! 38: #include "mouse.h" ! 39: ! 40: #ifdef CIOLIBEXPORT ! 41: #undef CIOLIBEXPORT ! 42: #endif ! 43: ! 44: #ifdef _WIN32 ! 45: #ifdef __BORLANDC__ ! 46: #define CIOLIBCALL __stdcall ! 47: #else ! 48: #define CIOLIBCALL ! 49: #endif ! 50: #if defined(CIOLIB_IMPORTS) || defined(CIOLIB_EXPORTS) ! 51: #if defined(CIOLIB_IMPORTS) ! 52: #define CIOLIBEXPORT __declspec( dllimport ) ! 53: #define CIOLIBEXPORTVAR __declspec( dllimport ) ! 54: #else ! 55: #define CIOLIBEXPORT __declspec( dllexport ) ! 56: #define CIOLIBEXPORTVAR __declspec( dllexport ) ! 57: #endif ! 58: #else /* self-contained executable */ ! 59: #define CIOLIBEXPORT ! 60: #define CIOLIBEXPORTVAR extern ! 61: #endif ! 62: #elif defined __unix__ ! 63: #define CIOLIBCALL ! 64: #define CIOLIBEXPORT ! 65: #define CIOLIBEXPORTVAR extern ! 66: #else ! 67: #define CIOLIBCALL ! 68: #define CIOLIBEXPORT ! 69: #define CIOLIBEXPORTVAR extern ! 70: #endif ! 71: ! 72: enum { ! 73: CIOLIB_MODE_AUTO ! 74: ,CIOLIB_MODE_CURSES ! 75: ,CIOLIB_MODE_CURSES_IBM ! 76: ,CIOLIB_MODE_ANSI ! 77: ,CIOLIB_MODE_X ! 78: ,CIOLIB_MODE_CONIO ! 79: ,CIOLIB_MODE_SDL ! 80: ,CIOLIB_MODE_SDL_FULLSCREEN ! 81: }; ! 82: ! 83: #if defined(_WIN32) /* presumably, Win32 */ ! 84: ! 85: #include <io.h> /* isatty */ ! 86: ! 87: #endif ! 88: ! 89: #ifndef __COLORS ! 90: #define __COLORS ! 91: ! 92: enum { ! 93: BLACK ! 94: ,BLUE ! 95: ,GREEN ! 96: ,CYAN ! 97: ,RED ! 98: ,MAGENTA ! 99: ,BROWN ! 100: ,LIGHTGRAY ! 101: ,DARKGRAY ! 102: ,LIGHTBLUE ! 103: ,LIGHTGREEN ! 104: ,LIGHTCYAN ! 105: ,LIGHTRED ! 106: ,LIGHTMAGENTA ! 107: ,YELLOW ! 108: ,WHITE ! 109: }; ! 110: ! 111: #endif /* __COLORS */ ! 112: ! 113: #ifndef BLINK ! 114: #define BLINK 128 ! 115: #endif ! 116: ! 117: enum text_modes ! 118: { ! 119: /* DOS-compatible modes */ ! 120: ! 121: LASTMODE = -1, ! 122: BW40 = 0, ! 123: C40, ! 124: BW80, ! 125: C80, ! 126: MONO = 7, ! 127: ! 128: /* New Color modes */ ! 129: ! 130: C40X14 = 8, ! 131: C40X21, ! 132: C40X28, ! 133: C40X43, ! 134: C40X50, ! 135: C40X60, ! 136: ! 137: C80X14, ! 138: C80X21, ! 139: C80X28, ! 140: C80X43, ! 141: C80X50, ! 142: C80X60, ! 143: ! 144: /* New Black & White modes */ ! 145: ! 146: BW40X14, ! 147: BW40X21, ! 148: BW40X28, ! 149: BW40X43, ! 150: BW40X50, ! 151: BW40X60, ! 152: ! 153: BW80X14, ! 154: BW80X21, ! 155: BW80X28, ! 156: BW80X43, ! 157: BW80X50, ! 158: BW80X60, ! 159: ! 160: /* New Monochrome modes */ ! 161: ! 162: MONO14, /* Invalid VGA mode */ ! 163: MONO21, ! 164: MONO28, ! 165: MONO43, ! 166: MONO50, ! 167: MONO60, ! 168: ! 169: C4350 = C80X50, /* this is actually "64" in the "real" conio */ ! 170: ! 171: _ORIGMODE = 65 /* original mode at program startup */ ! 172: }; ! 173: ! 174: #define COLOR_MODE C80 ! 175: ! 176: enum ! 177: { ! 178: _NOCURSOR, ! 179: _SOLIDCURSOR, ! 180: _NORMALCURSOR ! 181: }; ! 182: ! 183: struct text_info { ! 184: unsigned char winleft; /* left window coordinate */ ! 185: unsigned char wintop; /* top window coordinate */ ! 186: unsigned char winright; /* right window coordinate */ ! 187: unsigned char winbottom; /* bottom window coordinate */ ! 188: unsigned char attribute; /* text attribute */ ! 189: unsigned char normattr; /* normal attribute */ ! 190: unsigned char currmode; /* current video mode: ! 191: BW40, BW80, C40, C80, or C4350 */ ! 192: unsigned char screenheight; /* text screen's height */ ! 193: unsigned char screenwidth; /* text screen's width */ ! 194: unsigned char curx; /* x-coordinate in current window */ ! 195: unsigned char cury; /* y-coordinate in current window */ ! 196: }; ! 197: ! 198: typedef struct { ! 199: int mode; ! 200: int mouse; ! 201: void (*clreol) (void); ! 202: int (*puttext) (int,int,int,int,void *); ! 203: int (*gettext) (int,int,int,int,void *); ! 204: void (*textattr) (int); ! 205: int (*kbhit) (void); ! 206: void (*delay) (long); ! 207: int (*wherex) (void); ! 208: int (*wherey) (void); ! 209: int (*putch) (int); ! 210: void (*gotoxy) (int,int); ! 211: void (*clrscr) (void); ! 212: void (*gettextinfo) (struct text_info *); ! 213: void (*setcursortype)(int); ! 214: int (*getch) (void); ! 215: int (*getche) (void); ! 216: int (*beep) (void); ! 217: void (*highvideo) (void); ! 218: void (*lowvideo) (void); ! 219: void (*normvideo) (void); ! 220: void (*textmode) (int); ! 221: int (*ungetch) (int); ! 222: int (*movetext) (int,int,int,int,int,int); ! 223: char *(*cgets) (char *); ! 224: int (*cscanf) (char *,...); ! 225: char *(*getpass) (const char *); ! 226: void (*wscroll) (void); ! 227: void (*window) (int,int,int,int); ! 228: void (*delline) (void); ! 229: void (*insline) (void); ! 230: int (*cprintf) (char *,...); ! 231: int (*cputs) (char *); ! 232: void (*textbackground) (int); ! 233: void (*textcolor) (int); ! 234: int (*getmouse) (struct mouse_event *mevent); ! 235: int (*ungetmouse) (struct mouse_event *mevent); ! 236: int (*hidemouse) (void); ! 237: int (*showmouse) (void); ! 238: void (*settitle) (const char *); ! 239: void (*setname) (const char *); ! 240: void (*copytext) (const char *, size_t); ! 241: char *(*getcliptext) (void); ! 242: void (*suspend) (void); ! 243: void (*resume) (void); ! 244: int (*setfont) (int font, int force); ! 245: int (*getfont) (void); ! 246: int (*loadfont) (char *filename); ! 247: int *ESCDELAY; ! 248: } cioapi_t; ! 249: ! 250: CIOLIBEXPORTVAR cioapi_t cio_api; ! 251: CIOLIBEXPORTVAR int _wscroll; ! 252: CIOLIBEXPORTVAR int directvideo; ! 253: CIOLIBEXPORTVAR int hold_update; ! 254: CIOLIBEXPORTVAR int puttext_can_move; ! 255: ! 256: #define _conio_kbhit() kbhit() ! 257: ! 258: #ifdef __cplusplus ! 259: extern "C" { ! 260: #endif ! 261: CIOLIBEXPORT int CIOLIBCALL initciolib(int mode); ! 262: CIOLIBEXPORT void CIOLIBCALL suspendciolib(void); ! 263: ! 264: CIOLIBEXPORT int CIOLIBCALL ciolib_movetext(int sx, int sy, int ex, int ey, int dx, int dy); ! 265: CIOLIBEXPORT char * CIOLIBCALL ciolib_cgets(char *str); ! 266: CIOLIBEXPORT int CIOLIBCALL ciolib_cscanf (char *format , ...); ! 267: CIOLIBEXPORT int CIOLIBCALL ciolib_kbhit(void); ! 268: CIOLIBEXPORT int CIOLIBCALL ciolib_getch(void); ! 269: CIOLIBEXPORT int CIOLIBCALL ciolib_getche(void); ! 270: CIOLIBEXPORT int CIOLIBCALL ciolib_ungetch(int ch); ! 271: CIOLIBEXPORT void CIOLIBCALL ciolib_gettextinfo(struct text_info *info); ! 272: CIOLIBEXPORT int CIOLIBCALL ciolib_wherex(void); ! 273: CIOLIBEXPORT int CIOLIBCALL ciolib_wherey(void); ! 274: CIOLIBEXPORT void CIOLIBCALL ciolib_wscroll(void); ! 275: CIOLIBEXPORT void CIOLIBCALL ciolib_gotoxy(int x, int y); ! 276: CIOLIBEXPORT void CIOLIBCALL ciolib_clreol(void); ! 277: CIOLIBEXPORT void CIOLIBCALL ciolib_clrscr(void); ! 278: CIOLIBEXPORT int CIOLIBCALL ciolib_cputs(char *str); ! 279: CIOLIBEXPORT int CIOLIBCALL ciolib_cprintf(char *fmat, ...); ! 280: CIOLIBEXPORT void CIOLIBCALL ciolib_textbackground(int colour); ! 281: CIOLIBEXPORT void CIOLIBCALL ciolib_textcolor(int colour); ! 282: CIOLIBEXPORT void CIOLIBCALL ciolib_highvideo(void); ! 283: CIOLIBEXPORT void CIOLIBCALL ciolib_lowvideo(void); ! 284: CIOLIBEXPORT void CIOLIBCALL ciolib_normvideo(void); ! 285: CIOLIBEXPORT int CIOLIBCALL ciolib_puttext(int a,int b,int c,int d,unsigned char *e); ! 286: CIOLIBEXPORT int CIOLIBCALL ciolib_gettext(int a,int b,int c,int d,unsigned char *e); ! 287: CIOLIBEXPORT void CIOLIBCALL ciolib_textattr(int a); ! 288: CIOLIBEXPORT void CIOLIBCALL ciolib_delay(long a); ! 289: CIOLIBEXPORT int CIOLIBCALL ciolib_putch(int a); ! 290: CIOLIBEXPORT void CIOLIBCALL ciolib_setcursortype(int a); ! 291: CIOLIBEXPORT void CIOLIBCALL ciolib_textmode(int mode); ! 292: CIOLIBEXPORT void CIOLIBCALL ciolib_window(int sx, int sy, int ex, int ey); ! 293: CIOLIBEXPORT void CIOLIBCALL ciolib_delline(void); ! 294: CIOLIBEXPORT void CIOLIBCALL ciolib_insline(void); ! 295: CIOLIBEXPORT char * CIOLIBCALL ciolib_getpass(const char *prompt); ! 296: CIOLIBEXPORT void CIOLIBCALL ciolib_settitle(const char *title); ! 297: CIOLIBEXPORT void CIOLIBCALL ciolib_setname(const char *title); ! 298: CIOLIBEXPORT int CIOLIBCALL ciolib_showmouse(void); ! 299: CIOLIBEXPORT int CIOLIBCALL ciolib_hidemouse(void); ! 300: CIOLIBEXPORT void CIOLIBCALL ciolib_copytext(const char *text, size_t buflen); ! 301: CIOLIBEXPORT char * CIOLIBCALL ciolib_getcliptext(void); ! 302: CIOLIBEXPORT int CIOLIBCALL ciolib_setfont(int font, int force); ! 303: CIOLIBEXPORT int CIOLIBCALL ciolib_getfont(void); ! 304: CIOLIBEXPORT int CIOLIBCALL ciolib_loadfont(char *filename); ! 305: #ifdef __cplusplus ! 306: } ! 307: #endif ! 308: ! 309: #ifndef CIOLIB_NO_MACROS ! 310: #define cscanf ciolib_cscanf ! 311: #define cprintf ciolib_cprintf ! 312: ! 313: #define movetext(a,b,c,d,e,f) ciolib_movetext(a,b,c,d,e,f) ! 314: #define cgets(a) ciolib_cgets(a) ! 315: #define kbhit() ciolib_kbhit() ! 316: #define getch() ciolib_getch() ! 317: #define getche() ciolib_getche() ! 318: #define ungetch(a) ciolib_ungetch(a) ! 319: #define gettextinfo(a) ciolib_gettextinfo(a) ! 320: #define wherex() ciolib_wherex() ! 321: #define wherey() ciolib_wherey() ! 322: #define wscroll() ciolib_wscroll() ! 323: #define gotoxy(a,b) ciolib_gotoxy(a,b) ! 324: #define clreol() ciolib_clreol() ! 325: #define clrscr() ciolib_clrscr() ! 326: #define cputs(a) ciolib_cputs(a) ! 327: #define textbackground(a) ciolib_textbackground(a) ! 328: #define textcolor(a) ciolib_textcolor(a) ! 329: #define highvideo() ciolib_highvideo() ! 330: #define lowvideo() ciolib_lowvideo() ! 331: #define normvideo() ciolib_normvideo() ! 332: #define puttext(a,b,c,d,e) ciolib_puttext(a,b,c,d,e) ! 333: #define gettext(a,b,c,d,e) ciolib_gettext(a,b,c,d,e) ! 334: #define textattr(a) ciolib_textattr(a) ! 335: #define delay(a) ciolib_delay(a) ! 336: #define putch(a) ciolib_putch(a) ! 337: #define _setcursortype(a) ciolib_setcursortype(a) ! 338: #define textmode(a) ciolib_textmode(a) ! 339: #define window(a,b,c,d) ciolib_window(a,b,c,d) ! 340: #define delline() ciolib_delline() ! 341: #define insline() ciolib_insline() ! 342: #define getpass(a) ciolib_getpass(a) ! 343: #define getmouse(a) ciolib_getmouse(a) ! 344: #define ungetmouse(a) ciolib_ungetmouse(a) ! 345: #define hidemouse() ciolib_hidemouse() ! 346: #define showmouse() ciolib_showmouse() ! 347: #define setname(a) ciolib_setname(a) ! 348: #define settitle(a) ciolib_settitle(a) ! 349: #define copytext(a,b) ciolib_copytext(a,b) ! 350: #define getcliptext() ciolib_getcliptext() ! 351: #define setfont(a,b) ciolib_setfont(a,b) ! 352: #define getfont() ciolib_getfont() ! 353: #define loadfont(a) ciolib_loadfont(a) ! 354: #endif ! 355: ! 356: #endif /* Do not add anything after this line */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.