home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 371_01 / windosio.h < prev   
Text File  |  1992-01-12  |  33KB  |  1,014 lines

  1. /**************************************************************************
  2. *  WinDosIO.h
  3. *  These functions allow standard IO compatability when executing under
  4. *  Microsoft Windows 3.0. They represent the complete interface to the
  5. *  Graubart-Cervone WinDosIO library.
  6. *  Copyright 1991, Graubart-Cervone Software
  7. ***************************************************************************/
  8. #if !defined(WINDOSIO_H )
  9. #define WINDOSIO_H
  10.  
  11. #define _NOCURSOR      0
  12. #define _SOLIDCURSOR   1
  13. #define _NORMALCURSOR  2
  14. #define _USERCURSOR    99
  15.  
  16.  
  17. struct text_info {
  18.     unsigned char winleft;
  19.     unsigned char wintop;
  20.     unsigned char winright;
  21.     unsigned char winbottom;
  22.     unsigned char attribute;
  23.     unsigned char normattr;
  24.     unsigned char currmode;
  25.     unsigned char screenheight;
  26.     unsigned char screenwidth;
  27.     unsigned char curx;
  28.     unsigned char cury;
  29. };
  30.  
  31. enum text_modes { LASTMODE=-1, BW40=0, C40, BW80, C80, MONO=7, C4350=64 };
  32.  
  33.  
  34.  
  35.  
  36. enum graphics_errors {        /* graphresult error return codes */
  37.     grOk           =   0,
  38.     grNoInitGraph       =  -1,
  39.     grNotDetected       =  -2,
  40.     grFileNotFound       =  -3,
  41.     grInvalidDriver    =  -4,
  42.     grNoLoadMem       =  -5,
  43.     grNoScanMem       =  -6,
  44.     grNoFloodMem       =  -7,
  45.     grFontNotFound       =  -8,
  46.     grNoFontMem       =  -9,
  47.     grInvalidMode       = -10,
  48.     grError        = -11,   /* generic error */
  49.     grIOerror       = -12,
  50.     grInvalidFont       = -13,
  51.     grInvalidFontNum   = -14,
  52.     grInvalidVersion   = -18,
  53.     grMSParameter       = -40,
  54.     grMSImage       = -41,
  55.     grMSNoOutput       = -42,
  56.     grMSClipped       = -43,
  57.     grMSParmAltered    = -44
  58. };
  59.  
  60. enum graphics_drivers {     /* define graphics drivers */
  61.     DETECT,         /* requests autodetection */
  62.     CGA, MCGA, EGA, EGA64, EGAMONO, IBM8514,    /* 1 - 6 */
  63.     HERCMONO, ATT400, VGA, PC3270,            /* 7 - 10 */
  64.     CURRENT_DRIVER = -1
  65. };
  66.  
  67. enum graphics_modes {        /* graphics modes for each driver */
  68.     CGAC0      = 0,  /* 320x200 palette 0; 1 page    */
  69.     CGAC1      = 1,  /* 320x200 palette 1; 1 page    */
  70.     CGAC2      = 2,  /* 320x200 palette 2: 1 page    */
  71.     CGAC3      = 3,  /* 320x200 palette 3; 1 page    */
  72.     CGAHI      = 4,  /* 640x200 1 page            */
  73.     MCGAC0     = 0,  /* 320x200 palette 0; 1 page    */
  74.     MCGAC1     = 1,  /* 320x200 palette 1; 1 page    */
  75.     MCGAC2     = 2,  /* 320x200 palette 2; 1 page    */
  76.     MCGAC3     = 3,  /* 320x200 palette 3; 1 page    */
  77.     MCGAMED    = 4,  /* 640x200 1 page            */
  78.     MCGAHI     = 5,  /* 640x480 1 page            */
  79.     EGALO      = 0,  /* 640x200 16 color 4 pages    */
  80.     EGAHI      = 1,  /* 640x350 16 color 2 pages    */
  81.     EGA64LO    = 0,  /* 640x200 16 color 1 page     */
  82.     EGA64HI    = 1,  /* 640x350 4 color  1 page     */
  83.     EGAMONOHI  = 0,  /* 640x350 64K on card, 1 page - 256K on card, 4 pages */
  84.     HERCMONOHI = 0,  /* 720x348 2 pages         */
  85.     ATT400C0   = 0,  /* 320x200 palette 0; 1 page    */
  86.     ATT400C1   = 1,  /* 320x200 palette 1; 1 page    */
  87.     ATT400C2   = 2,  /* 320x200 palette 2; 1 page    */
  88.     ATT400C3   = 3,  /* 320x200 palette 3; 1 page    */
  89.     ATT400MED  = 4,  /* 640x200 1 page            */
  90.     ATT400HI   = 5,  /* 640x400 1 page            */
  91.     VGALO      = 0,  /* 640x200 16 color 4 pages    */
  92.     VGAMED     = 1,  /* 640x350 16 color 2 pages    */
  93.     VGAHI      = 2,  /* 640x480 16 color 1 page     */
  94.     PC3270HI   = 0,  /* 720x350 1 page            */
  95.     IBM8514LO  = 0,  /* 640x480 256 colors        */
  96.     IBM8514HI  = 1   /*1024x768 256 colors        */
  97. };
  98.  
  99. /* Colors for setpalette and setallpalette */
  100.  
  101. #if    !defined(__COLORS)
  102. #define __COLORS
  103.  
  104. enum COLORS {
  105.     BLACK,            /* dark colors */
  106.     BLUE,
  107.     GREEN,
  108.     CYAN,
  109.     RED,
  110.     MAGENTA,
  111.     BROWN,
  112.     LIGHTGRAY,
  113.     DARKGRAY,            /* light colors */
  114.     LIGHTBLUE,
  115.     LIGHTGREEN,
  116.     LIGHTCYAN,
  117.     LIGHTRED,
  118.     LIGHTMAGENTA,
  119.     YELLOW,
  120.     WHITE
  121. };
  122. #endif
  123.  
  124. enum CGA_COLORS {
  125.     CGA_LIGHTGREEN     = 1,        /* Palette C0 Color Names    */
  126.     CGA_LIGHTRED       = 2,
  127.     CGA_YELLOW           = 3,
  128.  
  129.     CGA_LIGHTCYAN      = 1,        /* Palette C1 Color Names    */
  130.     CGA_LIGHTMAGENTA   = 2,
  131.     CGA_WHITE           = 3,
  132.  
  133.     CGA_GREEN           = 1,        /* Palette C2 Color Names    */
  134.     CGA_RED           = 2,
  135.     CGA_BROWN           = 3,
  136.  
  137.     CGA_CYAN           = 1,        /* Palette C3 Color Names    */
  138.     CGA_MAGENTA        = 2,
  139.     CGA_LIGHTGRAY      = 3
  140. };
  141.  
  142.  
  143. enum EGA_COLORS {
  144.     EGA_BLACK         =  0,        /* dark colors */
  145.     EGA_BLUE         =  1,
  146.     EGA_GREEN         =  2,
  147.     EGA_CYAN         =  3,
  148.     EGA_RED         =  4,
  149.     EGA_MAGENTA      =  5,
  150.     EGA_BROWN         =  20,
  151.     EGA_LIGHTGRAY     =  7,
  152.     EGA_DARKGRAY     =  56,     /* light colors */
  153.     EGA_LIGHTBLUE     =  57,
  154.     EGA_LIGHTGREEN     =  58,
  155.     EGA_LIGHTCYAN     =  59,
  156.     EGA_LIGHTRED     =  60,
  157.     EGA_LIGHTMAGENTA     =  61,
  158.     EGA_YELLOW         =  62,
  159.     EGA_WHITE         =  63
  160. };
  161.  
  162. enum line_styles {        /* Line styles for get/setlinestyle */
  163.     SOLID_LINE   = 0,
  164.     DOTTED_LINE  = 1,
  165.     CENTER_LINE  = 2,
  166.     DASHED_LINE  = 3,
  167.     USERBIT_LINE = 4,    /* User defined line style */
  168.     DASHDOT_LINE = 5,
  169.     DASHDOTDOT_LINE = 6
  170. };
  171.  
  172. enum line_widths {        /* Line widths for get/setlinestyle */
  173.     NORM_WIDTH  = 1,    /* WinDosIO allows any line thickness */
  174.     THICK_WIDTH = 3,    /* Mneumonics for compatability only */
  175. };
  176.  
  177. enum font_names {
  178.     DEFAULT_FONT    = 0,    /* 8x8 bit mapped font */
  179.     TRIPLEX_FONT    = 1,    /* "Stroked" fonts */
  180.     SMALL_FONT    = 2,
  181.     SANS_SERIF_FONT = 3,
  182.     GOTHIC_FONT    = 4,
  183.     MICROSTYLE_FONT = 99
  184. };
  185.  
  186. #define HORIZ_DIR    0    /* left to right */
  187. #define VERT_DIR    1    /* bottom to top */
  188.  
  189. #define USER_CHAR_SIZE    0    /* user-defined char size */
  190.  
  191. enum fill_patterns {        /* Fill patterns for get/setfillstyle */
  192.     EMPTY_FILL,        /* fills area in background color */
  193.     SOLID_FILL,        /* fills area in solid fill color */
  194.     LINE_FILL,        /* --- fill */
  195.     LTSLASH_FILL,        /* /// fill */
  196.     SLASH_FILL,        /* /// fill with thick lines */
  197.     BKSLASH_FILL,        /* \\\ fill with thick lines */
  198.     LTBKSLASH_FILL,     /* \\\ fill */
  199.     HATCH_FILL,        /* light hatch fill */
  200.     XHATCH_FILL,        /* heavy cross hatch fill */
  201.     INTERLEAVE_FILL,    /* interleaving line fill */
  202.     WIDE_DOT_FILL,        /* Widely spaced dot fill */
  203.     CLOSE_DOT_FILL,     /* Closely spaced dot fill */
  204.     USER_FILL        /* user defined fill */
  205. };
  206.  
  207. enum putimage_ops {        /* BitBlt operators for putimage */
  208.     COPY_PUT,        /* MOV */
  209.     XOR_PUT,        /* XOR */
  210.     OR_PUT,         /* OR  */
  211.     AND_PUT,        /* AND */
  212.     NOT_PUT         /* NOT */
  213. };
  214.  
  215. enum text_just {        /* Horizontal and vertical justification
  216.                    for settextjustify */
  217.     LEFT_TEXT    = 0,
  218.     CENTER_TEXT    = 1,
  219.     RIGHT_TEXT    = 2,
  220.  
  221.     BOTTOM_TEXT    = 0,
  222.      /* CENTER_TEXT    = 1,  already defined above */
  223.     TOP_TEXT    = 2
  224. };
  225.  
  226.  
  227. #define MAXCOLORS 15
  228. #define MAXPAGES  4
  229.  
  230. struct palettetype {
  231.     unsigned char size;
  232.     signed char colors[MAXCOLORS+1];
  233. };
  234.  
  235. struct linesettingstype {
  236.     int linestyle;
  237.     unsigned upattern;
  238.     int thickness;
  239. };
  240.  
  241. struct textsettingstype {
  242.     int font;
  243.     int direction;
  244.     int charsize;
  245.     int horiz;
  246.     int vert;
  247. };
  248.  
  249. struct fillsettingstype {
  250.     int pattern;
  251.     int color;
  252. };
  253.  
  254. struct pointtype {
  255.     int x, y;
  256. };
  257.  
  258. struct viewporttype {
  259.     int left, top, right, bottom;
  260.     int clip;
  261. };
  262.  
  263. struct arccoordstype {
  264.     int x, y;
  265.     int xstart, ystart, xend, yend;
  266. };
  267.  
  268. struct CWS {
  269.     char far *cwsTitle;
  270.     unsigned long cwsFlags;
  271.     short cwsLeft;
  272.     short cwsTop;
  273.     short cwsXSize;
  274.     short cwsYSize;
  275. };
  276.  
  277.  
  278.  
  279. #if !defined( __DEFS_H )
  280. #include <_defs.h>
  281. #endif
  282.  
  283. #ifndef NULL
  284. #include <_null.h>
  285. #endif
  286.  
  287. #ifndef _SIZE_T
  288. #define _SIZE_T
  289. typedef unsigned size_t;
  290. #endif
  291.  
  292. /* Definition of the file position type
  293. */
  294. typedef long    fpos_t;
  295.  
  296.  
  297. /* Definition of the control structure for streams
  298. */
  299. typedef struct  {
  300.         int             level;          /* fill/empty level of buffer */
  301.         unsigned        flags;          /* File status flags          */
  302.         char            fd;             /* File descriptor            */
  303.         unsigned char   hold;           /* Ungetc char if no buffer   */
  304.         int             bsize;          /* Buffer size                */
  305.         unsigned char   _FAR *buffer;   /* Data transfer buffer       */
  306.         unsigned char   _FAR *curp;     /* Current active pointer     */
  307.         unsigned        istemp;         /* Temporary file indicator   */
  308.         short           token;          /* Used for validity checking */
  309. }       FILE;                           /* This is the FILE object    */
  310.  
  311. /* Bufferisation type to be used as 3rd argument for "setvbuf" function
  312. */
  313. #define _IOFBF  0
  314. #define _IOLBF  1
  315. #define _IONBF  2
  316.  
  317. /*  "flags" bits definitions
  318. */
  319. #define _F_RDWR 0x0003                  /* Read/write flag       */
  320. #define _F_READ 0x0001                  /* Read only file        */
  321. #define _F_WRIT 0x0002                  /* Write only file       */
  322. #define _F_BUF  0x0004                  /* Malloc'ed Buffer data */
  323. #define _F_LBUF 0x0008                  /* line-buffered file    */
  324. #define _F_ERR  0x0010                  /* Error indicator       */
  325. #define _F_EOF  0x0020                  /* EOF indicator         */
  326. #define _F_BIN  0x0040                  /* Binary file indicator */
  327. #define _F_IN   0x0080                  /* Data is incoming      */
  328. #define _F_OUT  0x0100                  /* Data is outgoing      */
  329. #define _F_TERM 0x0200                  /* File is a terminal    */
  330.  
  331. /* End-of-file constant definition
  332. */
  333. #define EOF (-1)            /* End of file indicator */
  334.  
  335. /* Number of files that can be open simultaneously
  336. */
  337. #if __STDC__
  338. #define FOPEN_MAX 18        /* Able to have 18 files (20 - stdaux & stdprn) */
  339. #else
  340. #define FOPEN_MAX 20        /* Able to have 20 files */
  341. #define SYS_OPEN  20
  342. #endif
  343.  
  344. #define FILENAME_MAX 80
  345.  
  346. /* Default buffer size use by "setbuf" function
  347. */
  348. #define BUFSIZ  512         /* Buffer size for stdio */
  349.  
  350. /* Size of an arry large enough to hold a temporary file name string
  351. */
  352. #define L_ctermid   5       /* CON: plus null byte */
  353. #define P_tmpdir    ""      /* temporary directory */
  354. #define L_tmpnam    13      /* tmpnam buffer size */
  355.  
  356. /* Constants to be used as 3rd argument for "fseek" function
  357. */
  358. #define SEEK_CUR    1
  359. #define SEEK_END    2
  360. #define SEEK_SET    0
  361.  
  362. /* Number of unique file names that shall be generated by "tmpnam" function
  363. */
  364. #define TMP_MAX     0xFFFF
  365.  
  366. /* Standard I/O predefined streams
  367. */
  368.  
  369. #if !defined( _RTLDLL )
  370. extern  FILE    _Cdecl _streams[];
  371. extern  unsigned    _Cdecl _nfile;
  372.  
  373. #define stdin   (&_streams[0])
  374. #define stdout  (&_streams[1])
  375. #define stderr  (&_streams[2])
  376.  
  377. #if !__STDC__
  378. #define stdaux  (&_streams[3])
  379. #define stdprn  (&_streams[4])
  380. #endif
  381.  
  382. #else
  383.  
  384. #ifdef __cplusplus
  385. extern "C" {
  386. #endif
  387. FILE far * far __getStream(int);
  388. #ifdef __cplusplus
  389. }
  390. #endif
  391.  
  392. #define stdin   __getStream(0)
  393. #define stdout  __getStream(1)
  394. #define stderr  __getStream(2)
  395. #define stdaux  __getStream(3)
  396. #define stdprn  __getStream(4)
  397.  
  398. #endif
  399.  
  400.  
  401. #ifdef __cplusplus
  402. extern "C" {
  403. #endif
  404.  
  405. /* Stdio functions which are not redefined in the WinDosIO DLL */
  406. int     _Cdecl _FARFUNC sprintf(char _FAR *__buffer, const char _FAR *__format, ...);
  407. int     _Cdecl _FARFUNC sscanf(const char _FAR *__buffer,
  408.                       const char _FAR *__format, ...);
  409.  
  410. char   _FAR *_Cdecl _FARFUNC strerror(int __errnum);
  411. FILE   _FAR *_Cdecl _FARFUNC tmpfile(void);
  412. char   _FAR *_Cdecl _FARFUNC tmpnam(char _FAR *__s);
  413. int     _Cdecl _FARFUNC vfprintf(FILE _FAR *__stream, const char _FAR *__format,
  414.                         void _FAR *__arglist);
  415. int     _Cdecl _FARFUNC vfscanf(FILE _FAR *__stream, const char _FAR *__format,
  416.                         void _FAR *__arglist);
  417. int     _Cdecl _FARFUNC vsprintf(char _FAR *__buffer, const char _FAR *__format,
  418.                         void _FAR *__arglist);
  419. int     _Cdecl _FARFUNC vsscanf(const char _FAR *__buffer, const char _FAR *__format,
  420.                         void _FAR *__arglist);
  421. int     _CType unlink(const char _FAR *__path);
  422.  
  423. #if !__STDC__
  424. int     _Cdecl _FARFUNC fcloseall(void);
  425. FILE   _FAR *_Cdecl _FARFUNC fdopen(int __handle, char _FAR *__type);
  426. int     _Cdecl _FARFUNC fputchar(int __c);
  427. FILE   _FAR * _Cdecl _fsopen (const char _FAR *__path, const char _FAR *__mode,
  428.                   int __shflag);
  429. int     _Cdecl rmtmp(void);
  430. char   _FAR * _Cdecl _FARFUNC tempnam(char _FAR *__dir, char _FAR *__pfx);
  431.  
  432. #define fileno(f)       ((f)->fd)
  433. #endif
  434.  
  435. #ifdef  __cplusplus
  436. }
  437. #endif
  438.  
  439.  
  440.  
  441.  
  442. #ifdef __cplusplus
  443. extern "C" {
  444. #endif
  445. int main(int argc, char *argv[]);
  446. int cdecl far printf(const char far *formatString,...);
  447. int cdecl far cprintf(const char far *formatString,...);
  448. int cdecl far vprintf(const char far *formatString, void far *pArguments);
  449. int cdecl far scanf(const char far *formatString,...);
  450. int cdecl far cscanf(const char far *formatString,...);
  451. int cdecl far vscanf(const char far *formatString, void far *pArguments);
  452. int cdecl far puts(const char far *str);
  453. int cdecl far cputs(const char far *str);
  454. void cdecl far gotoxy(int x, int y);
  455. void cdecl far window(int left, int top, int right, int bottom);
  456. void cdecl far gettextinfo(struct text_info far *t);
  457. int cdecl far gettext(int left,int top, int right, int bottom, void far *dest);
  458. int cdecl far puttext(int left, int top, int right, int bottom, void far *src);
  459. int cdecl far movetext(int left, int top, int right, int bottom,
  460.                         int destleft, int desttop);
  461. void cdecl far highvideo(void);
  462. void cdecl far lowvideo(void);
  463. void cdecl far normvideo(void);
  464. int cdecl far wherey(void);
  465. int cdecl far wherex(void);
  466. void cdecl far clreol(void);
  467. void cdecl far insline(void);
  468. void cdecl far delline(void);
  469. void cdecl far scrolldownwindow(int rows, int left, int top, int right,
  470.                     int bottom);
  471. void cdecl far scrollupwindow(int rows, int left, int top, int right,
  472.                     int bottom);
  473. void cdecl far textmode(int newmode);
  474. void cdecl far _setcursortype(int cur_t);
  475. int cdecl far ungetch(int ch);
  476. int cdecl far getch(void);
  477. int cdecl far getche(void);
  478. char far * cdecl far gets(char far *s);
  479. char far * cdecl far cgets(char far *s);
  480. char far * cdecl far getpass(char far *s);
  481. void cdecl far clrscr(void);
  482. int cdecl far putch(int c);
  483. int cdecl far kbhit(void);
  484. void cdecl far textattr(int newattr);
  485. void cdecl far textbackground(int newcolor);
  486. void cdecl far textcolor(int newcolor);
  487. void cdecl far ReturnToApplication(int retCode);
  488. int cdecl far ReturnToWindows(void);
  489. int pascal far WinDosIO(short type, unsigned short wParam,
  490.                          unsigned long lParam);
  491. /* Graphics functions */
  492. void cdecl far initgraph(int far * graphdriver, int far * graphmode,
  493.                  char far *path);
  494. void cdecl far detectgraph(int far *graphdriver, int far *graphmode);
  495. int cdecl far registerbgifont(void (far *)(void));
  496. int cdecl far registerbgidriver(void (far *)(void));
  497. int cdecl far installuserdriver(char far *, int huge (*)(void));
  498. unsigned cdecl far setgraphbufsize(unsigned);
  499. int cdecl far installuserfont(char *);
  500. void cdecl far restorecrtmode(void);
  501. void cdecl far setgraphmode(int);
  502. int cdecl far getgraphmode(void);
  503. int cdecl far graphresult(void);
  504. void cdecl far graphdefaults(void);
  505. char far * cdecl far getdrivername(void);
  506. char far * cdecl far getmodename(int mode_number);
  507. void cdecl far getmoderange(int graphdriver, int far *lomode, int far *himode);
  508. int cdecl far getmaxmode(void);
  509. char far * cdecl far grapherrormsg(int errorcode);
  510. void cdecl far setvisualpage(int page);
  511. void cdecl far setactivepage(int page);
  512. void cdecl far cleardevice(void);
  513. void cdecl far closegraph(void);
  514. void cdecl far setcolor(int color);
  515. void cdecl far setbkcolor(int color);
  516. int cdecl far getbkcolor(void);
  517. int cdecl far getcolor(void);
  518. int cdecl far getmaxx(void);
  519. int cdecl far getmaxy(void);
  520. int cdecl far getx(void);
  521. int cdecl far gety(void);
  522. void cdecl far putpixel(int x, int y, int color);
  523. unsigned cdecl far getpixel(int x, int y);
  524. unsigned cdecl far imagesize(int left, int top, int right, int bottom);
  525. void cdecl far getimage(int left, int top, int right, int bottom,
  526.                  void far *bitmap);
  527. void cdecl far putimage(int left, int top, void far *bitmap, int op);
  528. void cdecl far outtextxy(int x, int y, char far *textString);
  529. void cdecl far outtext(char far *textString);
  530. void cdecl far gettextsettings(struct textsettingstype far *textSettings);
  531. int cdecl far textheight(char far *textstring);
  532. int cdecl far textwidth(char far *textstring);
  533. void cdecl far settextjustify(int horiz, int vert);
  534. void cdecl far settextstyle(int font, int direction, int charsize);
  535. void cdecl far setusercharsize(int multx, int divx, int multy, int divy);
  536. void cdecl far moveto(int x, int y);
  537. void cdecl far moverel(int x, int y);
  538. void cdecl far lineto(int x, int y);
  539. void cdecl far line(int x1, int y1, int x2, int y2);
  540. void cdecl far linerel(int x, int y);
  541. void cdecl far setlinestyle(int linestyle, unsigned upattern, int thickness);
  542. void cdecl far setwritemode(int mode);
  543. void cdecl far getlinesettings(struct linesettingstype far *lineinfo);
  544. void cdecl far floodfill(int x, int y, int border);
  545. void cdecl far rectangle(int left, int top, int right, int bottom);
  546. void cdecl far circle(int x, int y, int radius);
  547. void cdecl far arc(int x, int y, int stangle, int endangle, int radius);
  548. void cdecl far getarccoords(struct arccoordstype far *arccoords);
  549. void cdecl far fillellipse(int x, int y, int xradius, int yradius);
  550. void cdecl far ellipse(int x, int y, int stangle, int endangle, 
  551.                     int xradius, int yradius);
  552. void cdecl far sector(int x, int y, int stangle, int endangle, 
  553.                     int xradius, int yradius);
  554. void cdecl far fillpoly(int numpoints, int far *polypoints);
  555. void cdecl far drawpoly(int numpoints, int far *polypoints);
  556. void cdecl far getaspectratio(int far *xasp, int far *yasp);
  557. void cdecl far setaspectratio(int xasp, int yasp);
  558. void cdecl far setviewport(int top, int left, int right, int bottom, int clip);
  559. void cdecl far getviewsettings(struct viewporttype far *viewport);
  560. void cdecl far clearviewport(void);
  561. void cdecl far pieslice(int x, int y, int stangle, int endangle, int radius);
  562. void cdecl far setfillstyle(int pattern, int color);
  563. void cdecl far getfillpattern(char far *pattern);
  564. void cdecl far getfillsettings(struct fillsettingstype far *fillInfo);
  565. void cdecl far setfillpattern(char far *pattern, int color);
  566. int cdecl far getmaxcolor(void);
  567. int cdecl far getpalettesize(void);
  568. struct palettetype far * cdecl far getdefaultpalette(void);
  569. void cdecl far getpalette(struct palettetype far *palette);
  570. void cdecl far setpalette(int colornum, int color);
  571. void cdecl far setallpalette(struct palettetype far *palette);
  572. void cdecl far bar(int left, int top, int right, int bottom);
  573. void cdecl far bar3d(int left, int top, int right, int bottom, int depth,
  574.                         int topflag);
  575. void cdecl far delay(unsigned milliseconds);
  576. void cdecl far sleep(unsigned seconds);
  577. /* Stdio functions */
  578. void cdecl far  clearerr(FILE far *stream);
  579. int cdecl far fclose(FILE far *stream);
  580. int cdecl far fflush(FILE far *stream);
  581. int cdecl far flushall(void);
  582. int cdecl far fgetc(FILE far *stream);
  583. int cdecl far fgetpos(FILE far *stream, fpos_t far *pos);
  584. char far * cdecl far fgets(char far *s, int n, FILE far *stream);
  585. int cdecl far fprintf(FILE far *stream, const char far *format, ...);
  586. int cdecl far fscanf(FILE far *stream, const char far *format,...);
  587. int cdecl far fputc(int c, FILE far *stream);
  588. int cdecl far fputs(const char far *s, FILE far *stream);
  589. size_t cdecl far fread(void far *ptr, size_t size, size_t n,FILE far *stream);
  590. FILE far * cdecl far freopen(const char far *path, const char far *mode,
  591.                              FILE far *stream);
  592. int cdecl far fscanf(FILE far *stream, const char far *format, ...);
  593. int cdecl far fseek(FILE far *stream, long offset, int whence);
  594. int cdecl far fsetpos(FILE far *stream, const fpos_t far *pos);
  595. long cdecl far ftell(FILE far *stream);
  596. FILE far * cdecl far fopen(const char far *filename, const char far *mode);
  597. size_t cdecl far fwrite(const void far *ptr, size_t size, size_t n,
  598.                  FILE far *stream);
  599. #undef ferror
  600. #undef feof
  601. int cdecl far ferror(FILE far *stream);
  602. int cdecl far feof(FILE far *stream);
  603. void cdecl far perror(const char far *s);
  604. #undef getchar
  605. #undef putchar
  606. #undef getc
  607. #undef putc
  608. #define getchar() fgetc(stdin)
  609. #define getc(s) fgetc(s)
  610. #define putchar(c) fputc(c,stdout)
  611. #define putc(c,s) fputc(c,s)
  612.  
  613. #ifndef _REG_DEFS
  614. #define _REG_DEFS
  615.  
  616. struct WORDREGS {
  617.     unsigned int    ax, bx, cx, dx, si, di, cflag, flags;
  618. };
  619.  
  620. struct BYTEREGS {
  621.     unsigned char   al, ah, bl, bh, cl, ch, dl, dh;
  622. };
  623.  
  624. union   REGS    {
  625.     struct  WORDREGS x;
  626.     struct  BYTEREGS h;
  627. };
  628.  
  629. struct  SREGS   {
  630.     unsigned int    es;
  631.     unsigned int    cs;
  632.     unsigned int    ss;
  633.     unsigned int    ds;
  634. };
  635.  
  636. struct  REGPACK {
  637.     unsigned    r_ax, r_bx, r_cx, r_dx;
  638.     unsigned    r_bp, r_si, r_di, r_ds, r_es, r_flags;
  639. };
  640.  
  641. #endif    /* _REG_DEFS */
  642.  
  643.  
  644.  
  645. int cdecl far intdos( union REGS far *__inregs,
  646.                            union REGS far *__outregs );
  647. int cdecl far intdosx( union REGS far *__inregs,
  648.                             union REGS far *__outregs,
  649.                             struct SREGS far *__segregs );
  650. int cdecl far int86(int intno, union REGS far *inregs,
  651.                    union REGS far *outregs);
  652. int cdecl far int86x(int intno, union REGS far *inregs,
  653.              union REGS far *outregs, struct SREGS far *segregs);
  654. int cdecl far bdos(int dosfun, unsigned dosdx, unsigned dosal);
  655. int cdecl far bdosptr(int dosfun, void far *argument, unsigned dosal);
  656. int cdecl far bioskey(int cmd);
  657. void cdecl far sound(unsigned frequency);
  658. void cdecl far nosound(void);
  659. int cdecl far allocmem(unsigned size, unsigned far *segp);
  660. int cdecl far freemem(unsigned segx);
  661. int cdecl far setblock(unsigned segx, unsigned newsize);
  662. unsigned long cdecl far coreleft(void);
  663. int cdecl far brk(void far *);
  664. void far * cdecl far sbrk(int);
  665. int cdecl far heapcheck(void);
  666. int cdecl far heapcheckfree(unsigned int);
  667. int cdecl far heapchecknode(void far *);
  668. int cdecl far heapfillfree(unsigned int);
  669. int cdecl far heapwalk(void far *);
  670.  
  671. #ifdef  __cplusplus
  672. }
  673. #endif
  674.  
  675.  
  676.  
  677. /* Microsoft Graphics functions */
  678. /************************************************************************
  679. *  Structures for Microsoft runtime compatability
  680. *************************************************************************/
  681. #ifndef _GRAPH_T_DEFINED
  682.  
  683. /* structure for _getvideoconfig() as visible to user */
  684. struct videoconfig {
  685.         short numxpixels;       /* number of pixels on X axis */
  686.         short numypixels;       /* number of pixels on Y axis */
  687.         short numtextcols;      /* number of text columns available */
  688.         short numtextrows;      /* number of text rows available */
  689.         short numcolors;        /* number of actual colors */
  690.         short bitsperpixel;     /* number of bits per pixel */
  691.         short numvideopages;    /* number of available video pages */
  692.         short mode;             /* current video mode */
  693.         short adapter;          /* active display adapter */
  694.         short monitor;          /* active display monitor */
  695.         short memory;           /* adapter video memory in K bytes */
  696. };
  697.  
  698. /* return value of _setlogorg(), etc. */
  699. struct xycoord {
  700.         short xcoord;
  701.         short ycoord;
  702. };
  703.  
  704. /* structure for text position */
  705. struct rccoord {
  706.         short row;
  707.         short col;
  708. };
  709.  
  710. /* Information on the current font */
  711. struct _fontinfo {
  712.     int type;
  713.     int ascent;
  714.     int pixwidth;
  715.     int pixheight;
  716.     int avgwidth;
  717.     char filename[80];
  718.     char facename[32];
  719. };
  720.  
  721. #define _GRAPH_T_DEFINED
  722.  
  723. #endif
  724.  
  725.  
  726. /* SETUP AND CONFIGURATION */
  727.  
  728.  
  729. /* arguments to _setvideomode() */
  730. #define _DEFAULTMODE    -1      /* restore screen to original mode */
  731. #define _TEXTBW40       0       /* 40 x 25 text, 16 grey */
  732. #define _TEXTC40        1       /* 40 x 25 text, 16/8 color */
  733. #define _TEXTBW80       2       /* 80 x 25 text, 16 grey */
  734. #define _TEXTC80        3       /* 80 x 25 text, 16/8 color */
  735. #define _MRES4COLOR     4       /* 320 x 200, 4 color */
  736. #define _MRESNOCOLOR    5       /* 320 x 200, 4 grey */
  737. #define _HRESBW         6       /* 640 x 200, BW */
  738. #define _TEXTMONO       7       /* 80 x 25 text, BW */
  739. #define _HERCMONO       8       /* 720 x 348, BW for HGC */
  740. #define _MRES16COLOR    13      /* 320 x 200, 16 color */
  741. #define _HRES16COLOR    14      /* 640 x 200, 16 color */
  742. #define _ERESNOCOLOR    15      /* 640 x 350, BW */
  743. #define _ERESCOLOR      16      /* 640 x 350, 4 or 16 color */
  744. #define _VRES2COLOR     17      /* 640 x 480, BW */
  745. #define _VRES16COLOR    18      /* 640 x 480, 16 color */
  746. #define _MRES256COLOR   19      /* 320 x 200, 256 color */
  747. #define _MAXRESMODE    30    /* Choose maximum resolution */
  748.  
  749.  
  750. /* videoconfig adapter values */
  751. /* these manifest constants can be used to determine the type of monitor in */
  752. /* use, using either simple comparisons or the bitwise-AND operator (&) */
  753. #define _MDPA       0x0001      /* Monochrome Display Adapter (MDPA) */
  754. #define _CGA        0x0002      /* Color Graphics Adapter     (CGA)  */
  755. #define _EGA        0x0004      /* Enhanced Graphics Adapter  (EGA)  */
  756. #define _VGA        0x0008      /* Video Graphics Array       (VGA)  */
  757. #define _MCGA       0x0010      /* MultiColor Graphics Array  (MCGA) */
  758. #define _HGC        0x0020      /* Hercules Graphics Card     (HGC)  */
  759.  
  760. /* videoconfig monitor values */
  761. /* these manifest constants can be used to determine the type of the active */
  762. /* adapter, using either simple comparisons or the bitwise-AND operator (&) */
  763. #define _MONO       0x0001      /* Monochrome */
  764. #define _COLOR      0x0002      /* Color (or Enhanced emulating color) */
  765. #define _ENHCOLOR   0x0004      /* Enhanced Color */
  766. #define _ANALOG     0x0018      /* Analog */
  767.  
  768.  
  769. /* ERROR VALUES */
  770. #define _GROK            0
  771. #define _GRERROR        (-1)
  772. #define _GRMODENOTSUPPORTED    (-2)
  773. #define _GRNOTINPROPERMODE    (-3)
  774. #define _GRINVALIDPARAMETER    (-4)
  775. #define _GRFONTFILENOTFOUND    (-5)
  776. #define _GRINVALIDFONTFILE    (-6)
  777. #define _GRCORRUPTEDFONTFILE    (-7)
  778. #define _GRINSUFFICIENTMEMORY    (-8)
  779. #define _GRINVALIDIMAGEBUFFER    (-9)
  780. /* Warnings */
  781. #define _GRNOOUTPUT        1
  782. #define _GRCLIPPED        2
  783. #define _GRPARAMETERALTERED    3
  784.  
  785. /* COORDINATE SYSTEMS */
  786.  
  787.  
  788. /* OUTPUT ROUTINES */
  789.  
  790. /* control parameters for Rectangle, Ellipse and Pie */
  791. #define _GBORDER        2       /* draw outline only */
  792. #define _GFILLINTERIOR  3       /* fill using current fill mask */
  793.  
  794. #define _GCLEARSCREEN 0
  795. #define _GVIEWPORT    1
  796. #define _GWINDOW      2
  797.  
  798.  
  799. /* PEN COLOR, LINE STYLE, FILL PATTERN */
  800.  
  801.  
  802. /* TEXT */
  803. #define _GCURSOROFF 0
  804. #define _GCURSORON  1
  805.  
  806. #define _GWRAPOFF   0
  807. #define _GWRAPON    1
  808.  
  809.  
  810. /* SCREEN IMAGES */
  811.  
  812. /* "action verbs" for _putimage() */
  813. #define _GPSET          3
  814. #define _GPRESET        2
  815. #define _GAND           1
  816. #define _GOR            0
  817. #define _GXOR           4
  818.  
  819. /* universal color values: */
  820. #define _BLACK          0x000000L
  821. #define _BLUE           0x2a0000L
  822. #define _GREEN          0x002a00L
  823. #define _CYAN           0x2a2a00L
  824. #define _RED            0x00002aL
  825. #define _MAGENTA        0x2a002aL
  826. #define _BROWN          0x00152aL
  827. #define _WHITE          0x2a2a2aL
  828. #define _GRAY           0x151515L
  829. #define _LIGHTBLUE      0x3F1515L
  830. #define _LIGHTGREEN     0x153f15L
  831. #define _LIGHTCYAN      0x3f3f15L
  832. #define _LIGHTRED       0x15153fL
  833. #define _LIGHTMAGENTA   0x3f153fL
  834. #define _LIGHTYELLOW    0x153f3fL
  835. #define _BRIGHTWHITE    0x3f3f3fL
  836.  
  837. /* mono mode F color values: */
  838. #define _MODEFOFF       0L
  839. #define _MODEFOFFTOON   1L
  840. #define _MODEFOFFTOHI   2L
  841. #define _MODEFONTOOFF   3L
  842. #define _MODEFON        4L
  843. #define _MODEFONTOHI    5L
  844. #define _MODEFHITOOFF   6L
  845. #define _MODEFHITOON    7L
  846. #define _MODEFHI        8L
  847.  
  848. /* mono mode 7 color values: */
  849. #define _MODE7OFF       0L
  850. #define _MODE7ON        1L
  851. #define _MODE7HI        2L
  852.  
  853.  
  854.  
  855. #define _MAXTEXTROWS    999
  856.  
  857.  
  858. #ifdef __cplusplus
  859. extern "C" {
  860. #endif
  861.  
  862. short far cdecl _setactivepage(short);
  863. short far cdecl _setvisualpage(short);
  864. short far cdecl _getvisualpage(void);
  865. short far cdecl _getactivepage(void);
  866. struct videoconfig far * far cdecl _getvideoconfig(struct videoconfig far *);
  867. struct xycoord far cdecl _setvieworg(short, short);
  868. struct xycoord far cdecl _setlogorg(short, short);
  869. struct xycoord far cdecl _getlogcoord(short, short);
  870. struct xycoord far cdecl _getviewcoord(short, short);
  871. struct xycoord far cdecl _getphyscoord(short, short);
  872. short far cdecl _setvideomode(short);
  873. short far cdecl _setvideomoderows(short mode, short rows);
  874.  
  875. void far cdecl _setcliprgn(short, short, short, short);
  876. void far cdecl _setviewport(short, short, short, short);
  877.  
  878. void far cdecl _clearscreen(short);
  879.  
  880. struct xycoord far cdecl _moveto(short, short);
  881. struct xycoord far cdecl _getcurrentposition(void);
  882.  
  883. short far cdecl _lineto(short, short);
  884. short far cdecl _rectangle(short, short, short, short, short);
  885. short far cdecl _ellipse(short, short, short, short, short);
  886. short far cdecl _arc(short, short, short, short, short, short, short, short);
  887. short far cdecl _pie(short, short, short, short, short, short, short,
  888.                  short, short);
  889. short far cdecl _polygon(short cntrl, struct xycoord far *points,
  890.                              short num_pnts);
  891.  
  892. short far cdecl _setpixel(short, short);
  893. short far cdecl _getpixel(short, short);
  894. short far cdecl _floodfill(short, short, short);
  895.  
  896. short far cdecl _setcolor(short);
  897. short far cdecl _getcolor(void);
  898.  
  899. void far cdecl _setlinestyle(unsigned short);
  900. unsigned short far cdecl _getlinestyle(void);
  901. short far cdecl _getarcinfo(struct xycoord far *start,struct xycoord far *end, 
  902.                 struct xycoord far *fillpoint);
  903. short far cdecl _grstatus(void);
  904.  
  905. void far cdecl _setfillmask(unsigned char far *);
  906. unsigned char far * far cdecl _getfillmask(unsigned char far *);
  907.  
  908. /* COLOR SELECTION */
  909.  
  910. long far cdecl _setbkcolor(long);
  911. long far cdecl _getbkcolor(void);
  912.  
  913. long far cdecl _remappalette(short, long);
  914. short far cdecl _remapallpalette(long far *);
  915. short far cdecl _selectpalette(short);
  916. short far cdecl _settextrows(short);
  917. void far cdecl _settextwindow(short, short, short, short);
  918. void far cdecl _gettextwindow(short far *r1, short far *c1,
  919.                   short far *r2, short far *c2);
  920. void far cdecl _scrolltextwindow(short scroll_lines);
  921. void far cdecl _outtext(char far *);
  922. void far cdecl _outmem(unsigned char far *text, short num_bytes);
  923. short far cdecl _wrapon(short);
  924. short far cdecl _displaycursor(short);
  925.  
  926. struct rccoord far cdecl _settextposition(short, short);
  927. struct rccoord far cdecl _gettextposition(void);
  928.  
  929. short far cdecl _settextcolor(short);
  930. short far cdecl _gettextcolor(void);
  931.  
  932. short far cdecl _settextcursor(short attr);
  933. short far cdecl _gettextcursor(void);
  934.  
  935.  
  936. short far cdecl _getwritemode(void);
  937. short far cdecl _setwritemode(short action);
  938.  
  939. short far cdecl  _setfont(unsigned char far *options);
  940. void far cdecl _outgtext(unsigned char far *text);
  941. struct xycoord far cdecl _setgtextvector(short x, short y);
  942. struct xycoord far cdecl _getgtextvector(void);
  943. short far cdecl _getgtextextent(unsigned char far *text);
  944. short far cdecl  _registerfonts(unsigned char far *);
  945. void far cdecl _unregisterfonts(void);
  946. short far cdecl _getfontinfo(struct _fontinfo far *buffer);
  947.  
  948.  
  949.  
  950. void far cdecl _getimage(short, short, short, short, char far *);
  951. void far cdecl _putimage(short, short, char far *, short);
  952. long far cdecl _imagesize(short, short, short, short);
  953.  
  954.  
  955. #ifdef  __cplusplus
  956. }
  957. #endif
  958.  
  959.  
  960.  
  961.  
  962. /* Terminal IO styles */
  963. #define WDS_SELECT        1L
  964. #define WDS_NOSCROLL        2L
  965. #define WDS_NOPAGES        4L
  966. #define WDS_NOTEXTBUFFER    8L
  967.  
  968. /* WinDosIO types */
  969. #define WD_INIT            1
  970. #define WD_SETFOCUS        2
  971. #define WD_GET_HDC        4
  972. #define WD_REGISTER_WINDOW    5
  973. #define WD_CREATE_CHILD_WINDOW    6
  974. #define WD_CREATE_MAIN_WINDOW    7
  975. #define WD_SETTITLE        8
  976. #define WD_DEFERPAINT        9
  977. #define WD_DESTROY        11
  978. #define WD_SELECT        12
  979. #define WD_CLOSE        13
  980. #define WD_GETERRNO        14
  981.  
  982.  
  983. struct WINDOSIO {
  984.     short wrapWidth;
  985. };
  986.  
  987.  
  988. /* WM_COMMAND notification codes */
  989. #define WDN_SETFOCUS    1
  990. #define WDN_KILLFOCUS    2
  991. #define WDN_LBUTTON    3
  992. #define WDN_RBUTTON    4
  993.  
  994. /* Error codes */
  995. #define WDE_UNINITIALIZED        -1
  996. #define WDE_NO_CURRENT_WINDOW        -2
  997. #define WDE_USERQUIT            -3
  998. #define WDE_TOO_MANY_WINDOWS        -4
  999. #define WDE_HANDLE_OUT_OF_RANGE     -5
  1000. #define WDE_DISK_ERROR            -6
  1001. #define WDE_ALREADY_UNGOT        -7
  1002. #define WDE_OUT_OF_MEMORY        -8
  1003. #define WDE_BAD_LINESIZE        -9
  1004. #define WDE_UNKNOWN_WDCODE        -10
  1005. #define WDE_NO_MORE_APPLICATIONS    -11
  1006. #define WDE_BAD_MODE            -12
  1007. #define WDE_BAD_X            -13
  1008. #define WDE_BAD_Y            -14
  1009. #define WDE_GRAPHICS_NOT_INITIALIZED    -15
  1010. #define WDE_BAD_SEGMENT            -16
  1011.  
  1012. #endif
  1013.  
  1014.