home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / lora299s.zip / CXL.H < prev    next >
C/C++ Source or Header  |  1998-05-12  |  33KB  |  748 lines

  1.  
  2. // LoraBBS Version 2.99 Free Edition
  3. // Copyright (C) 1987-98 Marco Maccaferri
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation; either version 2 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. // GNU General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software
  17. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. #if !defined(__CXL_H__)
  20. #define __CXL_H__
  21.  
  22. #include <ctype.h>
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25. #include <string.h>
  26.  
  27. #if defined(__LINUX__)
  28. #define ERR              (-1)
  29. #endif
  30.  
  31. #if defined(__DOS__)
  32. #include <bios.h>
  33. #include <conio.h>
  34. #include <dos.h>
  35. #endif
  36.  
  37. #if defined(__OS2__)
  38. #define INCL_NOPMAPI
  39. #define INCL_VIO
  40. #define INCL_MOU
  41. #include <os2.h>
  42. #endif
  43.  
  44. #if defined(__TURBOC__)                     /* Turbo C */
  45.     #if __STDC__
  46.         #define _Cdecl
  47.     #else
  48.         #define _Cdecl  cdecl
  49.     #endif
  50.     #define _Near
  51. #elif defined(__ZTC__)                      /* Zortech C++ */
  52.     #define _Cdecl
  53.     #define _Near
  54. #elif defined(__WATCOM__) && defined(__DOS__)
  55.     #define _Cdecl
  56.     #define _Near
  57. #elif defined(M_I86) && !defined(__ZTC__)   /* Microsoft C/QuickC */
  58.     #if !defined(NO_EXT_KEYS)
  59.         #define _Cdecl  cdecl
  60.         #define _Near   near
  61.     #else
  62.         #define _Cdecl
  63.         #define _Near
  64.     #endif
  65. #elif defined(__OS2__) || defined(__LINUX__) || defined(__NT__)
  66.     #define _Cdecl
  67.     #define _Near
  68. #endif
  69.  
  70. /*-----------------------[ Boolean logic conditions ]------------------------*/
  71.  
  72. #define NO      0
  73. #define YES     1
  74. #if !defined(FALSE)
  75. #define FALSE   0
  76. #endif
  77. #if !defined(TRUE)
  78. #define TRUE    1
  79. #endif
  80. #define OFF     0
  81. #define ON      1
  82.  
  83. /*-----------------[ definitions for common control codes ]------------------*/
  84.  
  85. #define NUL  0
  86. #define BEL  7
  87. #define BS   8
  88. #define HT   9
  89. #define LF   10
  90. #define FF   12
  91. #define CR   13
  92.  
  93. /*------------------------------[ CXLWIN type ]------------------------------*/
  94.  
  95. typedef short     CXLWIN;
  96.  
  97. /*-------------[ display adapter types returned from vidtype() ]-------------*/
  98.  
  99. //#define V_NONE      0
  100. #define V_MDA       1
  101. #define V_EGAMONO   2
  102. #define V_MCGAMONO  3
  103. #define V_VGAMONO   4
  104. #define V_HGC       5
  105. #define V_HGCPLUS   6
  106. #define V_INCOLOR   7
  107. #define V_CGA       8
  108. #define V_EGA       9
  109. #define V_MCGA      10
  110. #define V_VGA       11
  111.  
  112. /*------------------------[ video parameter settings ]-----------------------*/
  113.  
  114. #define VP_DMA    0     /* direct screen writes                     */
  115. #define VP_CGA    1     /* direct screen writes, eliminate CGA snow */
  116. #define VP_BIOS   2     /* BIOS screen writes                       */
  117. #define VP_MONO   3     /* monochrome attribute translation on      */
  118. #define VP_COLOR  4     /* monochrome attribute translation off     */
  119.  
  120. /*------------------------[ video information record ]-----------------------*/
  121.  
  122. struct _vinfo_t {
  123.     unsigned int    videoseg;   /* video buffer segment address */
  124.     unsigned char   adapter;    /* video adapter type           */
  125.     unsigned char   numrows;    /* number of displayed rows     */
  126.     unsigned char   numcols;    /* number of displayed columns  */
  127.     unsigned char   cheight;    /* character height in pixels   */
  128.     unsigned char   cwidth;     /* character width  in pixels   */
  129.     unsigned char   mono;       /* is it a monochrome adapter?  */
  130.     unsigned char   mapattr;    /* map color attribs to mono?   */
  131.     unsigned char   cgasnow;    /* is CGA snow present?         */
  132.     unsigned char   usebios;    /* use BIOS for video writes?   */
  133.     unsigned char   dvcheck;    /* check for DESQview?          */
  134.     unsigned char   dvexist;    /* is DESQview present?         */
  135. };
  136.  
  137. extern struct _vinfo_t _vinfo;
  138.  
  139. /*--------------[ attribute codes for functions that use them ]--------------*/
  140.  
  141. #if     !defined(BLACK)     /* foreground colors */
  142. #define BLACK       0
  143. #define BLUE        1
  144. #define GREEN       2
  145. #define CYAN        3
  146. #define RED         4
  147. #define MAGENTA     5
  148. #define BROWN       6
  149. #define YELLOW      14
  150. #define WHITE       15
  151. #endif
  152. #if     !defined(LGREY)
  153. #define LGREY       7       /* CXL abbreviates LIGHT as L    */
  154. #define DGREY       8       /* and DARK as D for ease of use */
  155. #define LBLUE       9
  156. #define LGREEN      10
  157. #define LCYAN       11
  158. #define LRED        12
  159. #define LMAGENTA    13
  160.  
  161. #define _BLACK      0       /* background colors */
  162. #define _BLUE       16
  163. #define _GREEN      32
  164. #define _CYAN       48
  165. #define _RED        64
  166. #define _MAGENTA    80
  167. #define _BROWN      96
  168. #define _LGREY      112
  169. #endif
  170.  
  171. #if     !defined(BLINK)
  172. #define BLINK       128     /* blink attribute */
  173. #endif
  174.  
  175. /*------------------------[ definition of kbuf record ]----------------------*/
  176.  
  177. struct _kbuf_t {
  178.     struct _kbuf_t *prev;       /* previous record */
  179.     struct _kbuf_t *next;       /* next record     */
  180.     unsigned xch;               /* keypress        */
  181. };
  182.  
  183. /*-----------------------[ definition of onkey record ]----------------------*/
  184.  
  185. struct _onkey_t {
  186.     struct _onkey_t *prev;      /* poshorter to previous record      */
  187.     struct _onkey_t *next;      /* poshorter to next record          */
  188.     unsigned short keycode;       /* Scan/ASCII code of trap key     */
  189.     void (*func) (void);        /* address of onkey function       */
  190.     unsigned short pass;          /* key to pass back, 0=don't pass  */
  191. };
  192.  
  193. /*-------------------[ definition of keyboard info record ]------------------*/
  194.  
  195. struct _kbinfo_t {
  196.     struct _kbuf_t *kbuf;       /* poshorter to head record in key buffer      */
  197.     struct _onkey_t *onkey;     /* poshorter to head record in onkey list      */
  198.     void (*kbloop) (void);      /* poshorter to function to call while waiting */
  199.     unsigned char inmenu;       /* inmenu flag used by menuing functions     */
  200.     unsigned char source;       /* source of keypress 0=kb, 1=kbuf, 2=mouse  */
  201. };
  202.  
  203. extern struct _kbinfo_t _kbinfo;
  204.  
  205. /*-------------[ keyboard status codes returned from kbstat() ]--------------*/
  206.  
  207. #define RSHIFT      1       /* right shift pressed   */
  208. #define LSHIFT      2       /* left shift pressed    */
  209. #define CTRL        4       /* [Ctrl] pressed        */
  210. #define SCRLOCK     16      /* [Scroll Lock] toggled */
  211. #define INS         128     /* [Ins] toggled         */
  212.  
  213. /*-------------[ error codes returned from windowing functions ]-------------*/
  214.  
  215. #define W_NOERROR   0       /* no error                          */
  216. #define W_ESCPRESS  1       /* Escape key was pressed            */
  217. #define W_ALLOCERR  2       /* memory allocation error           */
  218. #define W_NOTFOUND  3       /* record not found                  */
  219. #define W_NOACTIVE  4       /* no active window                  */
  220. #define W_INVCOORD  5       /* invalid coordinates               */
  221. #define W_INVFORMT  6       /* invalid format string             */
  222. #define W_NOINPDEF  7       /* no input fields defined           */
  223. #define W_STRLONG   8       /* string too long for window        */
  224. #define W_INVBTYPE  9       /* invalid box type                  */
  225. #define W_NOBORDER  10      /* no window border                  */
  226. #define W_NOHIDDEN  11      /* no hidden windows                 */
  227. #define W_NOTHIDD   12      /* window is not hidden              */
  228. #define W_NOSELECT  13      /* no selectable menu items          */
  229. #define W_NOITMDEF  14      /* no menu items defined             */
  230. #define W_NOMNUEND  15      /* no end of menu specified          */
  231. #define W_NOMNUDEF  16      /* no menu defined                   */
  232. #define W_NOMNUBEG  17      /* no begin of menu specified        */
  233. #define W_NOFRMDEF  18      /* no form defined                   */
  234. #define W_NOFRMBEG  19      /* no begin of form specified        */
  235. #define W_NOHLPDEF  20      /* no help record defined            */
  236. #define W_HLPSTKOV  21      /* help stack overflow               */
  237. #define W_HLPSTKUN  22      /* help stack underflow              */
  238. #define W_DOSERROR  23      /* DOS error                         */
  239. #define W_NOMATCH   24      /* no files matched input filespec   */
  240. #define W_INVTAGID  25      /* invalid tag identifier            */
  241.  
  242. /*-----------------------[ window border identifiers ]----------------------*/
  243.  
  244. #define TP_BORD  0      /* top border    */
  245. #define BT_BORD  1      /* bottom border */
  246. #define LT_BORD  2      /* left border   */
  247. #define RT_BORD  3      /* right border  */
  248.  
  249. /*--------------------------[ direction codes ]------------------------------*/
  250.  
  251. #define D_DOWN    0
  252. #define D_UP      1
  253. #define D_LEFT    2
  254. #define D_RIGHT   3
  255. #define SDOWN     D_DOWN    /* scroll down */
  256. #define SUP       D_UP      /* scroll up   */
  257.  
  258. /*----------------------[ menu item record definition ]----------------------*/
  259.  
  260. struct _item_t {
  261.     struct _item_t *prev;   /* poshorter to previous record      */
  262.     struct _item_t *next;   /* poshorter to next record          */
  263.     void *child;            /* poshorter to submenu's record     */
  264.     char *str;              /* address of selection string     */
  265.     char *desc;             /* text description of menu option */
  266.     void (*select) (void);  /* address of selection function   */
  267.     void (*before) (void);  /* address of "before" function    */
  268.     void (*after)  (void);  /* address of "after"  function    */
  269.     unsigned hotkey;        /* hot key to select function      */
  270.     short tagid;              /* tag identifier                  */
  271.     short help;               /* help category number            */
  272.     short wrow;               /* start of text - window row      */
  273.     unsigned char wcol;     /* start of text - window column   */
  274.     unsigned char schar;    /* quick selection character       */
  275.     unsigned char fmask;    /* special feature mask            */
  276.     unsigned char dwrow;    /* description window row          */
  277.     unsigned char dwcol;    /* description window column       */
  278.     unsigned char dattr;    /* description attribute           */
  279.     unsigned char redisp;   /* redisplay flag                  */
  280. };
  281.  
  282. /*--------------------[ window menu record definition ]----------------------*/
  283.  
  284. struct _menu_t {
  285.     struct _menu_t *prev;       /* poshorter to prev menu structure   */
  286.     struct _menu_t *next;       /* poshorter to next menu structure   */
  287.     struct _menu_t *parent;     /* poshorter to parent menu           */
  288.     struct _item_t *item;       /* poshorter to head menu item        */
  289.     struct _item_t *citem;      /* poshorter to current menu item     */
  290.     void (*open) (void);        /* address of post-opening function */
  291.     short tagcurr;                /* tag ID of item selection bar on  */
  292.     unsigned char usecurr;      /* will menu use current window?    */
  293.     unsigned char srow;         /* starting row of menu window      */
  294.     unsigned char scol;         /* starting column of menu window   */
  295.     unsigned char erow;         /* ending row of menu window        */
  296.     unsigned char ecol;         /* ending column of menu window     */
  297.     unsigned char btype;        /* menu window border type          */
  298.     unsigned char battr;        /* menu window border attribute     */
  299.     unsigned char wattr;        /* menu window attribute            */
  300.     unsigned char menutype;     /* menu type mask                   */
  301.     unsigned char barwidth;     /* width of menu bar or zero        */
  302.     unsigned char textpos;      /* offset of text from start of bar */
  303.     unsigned char textattr;     /* attribute of menu text           */
  304.     unsigned char scharattr;    /* attribute of selection character */
  305.     unsigned char noselattr;    /* non-selectable text attribute    */
  306.     unsigned char barattr;      /* attribute of selection bar       */
  307. };
  308.  
  309. /*--------------------[ window help information record ]---------------------*/
  310.  
  311. struct _help_t {
  312.     short help[20];               /* help stack                 */
  313.     char *file;                 /* help file name             */
  314.     short helpptr;                /* help stack poshorter         */
  315.     unsigned short  key;          /* help hot key               */
  316.     unsigned char winattr;      /* help window attribute      */
  317.     unsigned char textattr;     /* help window text attribute */
  318.     unsigned char selattr;      /* selection text attribute   */
  319.     unsigned char barattr;      /* selection bar attribute    */
  320.     unsigned char srow;         /* help window start row      */
  321.     unsigned char scol;         /* help window start column   */
  322.     unsigned char erow;         /* help window end row        */
  323.     unsigned char ecol;         /* help window end column     */
  324.     unsigned char btype;        /* help window box type       */
  325.     unsigned char title;        /* display "Help" title?      */
  326.     void (*open) (void);        /* poshorter to open function   */
  327. };
  328.  
  329. /*-----------------------[ window information record ]-----------------------*/
  330.  
  331. struct _winfo_t {
  332.     struct _wrec_t  *active;    /* poshorter to active window         */
  333.     struct _wrec_t  *hidden;    /* poshorter to head hidden window    */
  334.     struct _menu_t  *menu;      /* poshorter to head menu record      */
  335.     struct _menu_t  *cmenu;     /* poshorter to current menu record   */
  336.     struct _help_t  *helptr;    /* poshorter to help info record      */
  337.     CXLWIN handle;              /* last handle given to a window    */
  338.     short maxfiles;               /* max files allowed in wpickfile() */
  339.     short help;                   /* current help category            */
  340.     short error;                  /* error num from last window func  */
  341.     short total;                  /* total number of open windows     */
  342.     short mlevel,ilevel;          /* system variables used in menus   */
  343.     unsigned char esc;          /* check for Esc in input funcions? */
  344.     unsigned char tabwidth;     /* window TTY output tab width      */
  345.     unsigned char fillch;       /* character to fill windows with   */
  346. };
  347.  
  348. extern struct _winfo_t _winfo;
  349.  
  350. /*-------------------[ fmask definitions for wmenuitem() ]-------------------*/
  351.  
  352. #define M_HASPD     1   /* has pull-down menu attached   */
  353. #define M_NOSEL     2   /* is not selectable             */
  354. #define M_CLOSE     4   /* close menu after select func  */
  355. #define M_CLALL     8   /* close all menus when selected */
  356. #define M_CLOSB    16   /* close menu before select func */
  357.  
  358. /*------------------[ menutype definitions for wmenuend() ]------------------*/
  359.  
  360. #define M_HORZ      1       /* horizontal menu         */
  361. #define M_VERT      2       /* vertical menu           */
  362. #define M_OMNI      7       /* omnidirectional menu    */
  363. #define M_PD        8       /* pull-down menu          */
  364. #define M_NOQS      16      /* disable quick selection */
  365. #define M_SAVE      32      /* save last bar position  */
  366.  
  367. /*------------------[ special return codes from wmenuget() ]-----------------*/
  368.  
  369. #define M_EXIT      32764   /* exit menu               */
  370. #define M_EXITALL   32765   /* exit all menus          */
  371. #define M_PREVPD    32766   /* previous pull-down menu */
  372. #define M_NEXTPD    32767   /* next pull-down menu     */
  373.  
  374. /*---------------------[ window input field definition ]---------------------*/
  375.  
  376. struct _field_t {
  377.     struct _field_t *prev;      /* poshorter to previous field       */
  378.     struct _field_t *next;      /* poshorter to next field           */
  379.     char *str;                  /* address of receiving string     */
  380.     char *buf;                  /* address of temp receive string  */
  381.     char *format;               /* input field format string       */
  382.     short (*validate) (char *);   /* address of validation function  */
  383.     void (*before) (void);      /* address of "before" function    */
  384.     void (*after)  (void);      /* address of "after"  function    */
  385.     short help;                   /* help category number            */
  386.     short lenbuf;                 /* length of buffer                */
  387.     short lenfld;                 /* length of screen input field    */
  388.     short lenfmt;                 /* length of format string         */
  389.     unsigned char wrow;         /* start of input - window row     */
  390.     unsigned char wcol;         /* start of input - window column  */
  391.     unsigned char mode;         /* 0=init, 1=update, 2=cond update */
  392.     unsigned char decpos;       /* decimal position (numeric)      */
  393.     unsigned char redisp;       /* redisplay flag                  */
  394.     char fconv;                 /* field conversion character      */
  395. };
  396.  
  397. /*-------------------[ window data entry form definition ]-------------------*/
  398.  
  399. struct _form_t {
  400.     unsigned (*getkey) (short *); /* poshorter to alternate get func   */
  401.     struct _form_t  *prev;      /* poshorter to previous form record */
  402.     struct _form_t  *next;      /* poshorter to next form record     */
  403.     struct _field_t *field;     /* poshorter to head field record    */
  404.     struct _field_t *cfield;    /* poshorter to current field record */
  405.     unsigned *termkey;          /* addr of short for terminating key */
  406.     char *pformat;              /* format string poshorter           */
  407.     char *pbuf;                 /* buffer string poshorter           */
  408.     unsigned char cwrow;        /* current window row              */
  409.     unsigned char cwcol;        /* current window column           */
  410.     unsigned char decimal;      /* decimal field flag              */
  411.     unsigned char insert;       /* insert mode flag                */
  412.     unsigned char fieldattr;    /* field attribute                 */
  413.     unsigned char textattr;     /* text attribute                  */
  414. };
  415.  
  416. /*----------------------[ structure of window records ]----------------------*/
  417.  
  418. struct _wrec_t {
  419.     struct _wrec_t *prev;   /* poshorter to previous window record */
  420.     struct _wrec_t *next;   /* poshorter to next window record     */
  421.     struct _form_t *form;   /* poshorter to head form record       */
  422.     short *wbuf;            /* address of window's buffer        */
  423.     short *wsbuf;           /* address of window shadow's buffer */
  424.     char *title;            /* address of window's title string  */
  425.     CXLWIN whandle;         /* window's handle                   */
  426.     short help;               /* help category number              */
  427.     unsigned char srow;     /* start row of window               */
  428.     unsigned char scol;     /* start column of window            */
  429.     unsigned char erow;     /* end row of window                 */
  430.     unsigned char ecol;     /* end column of window              */
  431.     unsigned char btype;    /* window's box type                 */
  432.     unsigned char wattr;    /* window's initial text attribute   */
  433.     unsigned char battr;    /* atrribute of window's border      */
  434.     unsigned char border;   /* has border?  0 = no, 1 = yes      */
  435.     unsigned char row;      /* window's current cursor row       */
  436.     unsigned char column;   /* window's current cursor column    */
  437.     unsigned char attr;     /* window's current text attribute   */
  438.     unsigned char tpos;     /* position of window's title        */
  439.     unsigned char tattr;    /* attribute of window's title       */
  440.     unsigned char wsattr;   /* attribute of window's shadow      */
  441. };
  442.  
  443. /*------------[ window title position definitions for wtitle() ]-------------*/
  444.  
  445. #define TLEFT       1   /* left justified  */
  446. #define TCENTER     2   /* centered        */
  447. #define TRIGHT      3   /* right justified */
  448.  
  449. /*------------------------[ definition of NULL ]-----------------------------*/
  450.  
  451. #if !defined(NULL)
  452.     #if defined(__TURBOC__)                     /* Turbo C */
  453.         #if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
  454.             #define NULL    0
  455.         #else
  456.             #define NULL    0L
  457.         #endif
  458.     #elif defined(__ZTC__)                      /* Zortech C++ */
  459.         #ifdef LPTR
  460.             #define NULL    0L
  461.         #else
  462.             #define NULL    0
  463.         #endif
  464.     #elif defined(M_I86) && !defined(__ZTC__)   /* Microsoft C/QuickC */
  465.         #if defined(M_I86SM) || defined(M_I86MM)
  466.             #define NULL    0
  467.         #else
  468.             #define NULL    0L
  469.         #endif
  470.     #endif
  471. #endif
  472.  
  473. /*---------------------------[ function prototypes ]-------------------------*/
  474.  
  475. #ifdef __cplusplus
  476. extern "C" {
  477. #endif
  478.  
  479. char           *_Cdecl biosver(void);
  480. short             _Cdecl clockcal(void);
  481. char           *_Cdecl cxlver(void);
  482. void            _Cdecl delay_(unsigned duration);
  483. unsigned        _Cdecl expmem(void);
  484. unsigned        _Cdecl extmem(void);
  485. short             _Cdecl fcrypt(char *file,char *key);
  486. short             _Cdecl gameport(void);
  487. short             _Cdecl machid(void);
  488. short             _Cdecl mathchip(void);
  489. short             _Cdecl numflop(void);
  490. short             _Cdecl numpar(void);
  491. short             _Cdecl numser(void);
  492. char           *_Cdecl randfile(void);
  493. void            _Cdecl sound_(unsigned pitch,unsigned duration);
  494. void            _Cdecl _stdoutch(short ch);
  495. char           *_Cdecl sysdate(short dtype);
  496. char           *_Cdecl systime(short ttype);
  497. short             _Cdecl tabstop(short col,short tabwidth);
  498.  
  499. void     _Cdecl capsoff(void);
  500. void     _Cdecl capson(void);
  501. struct _onkey_t *_Cdecl chgonkey(struct _onkey_t *kblist);
  502. void     _Cdecl freonkey(void);
  503. short      _Cdecl getchf(char *valid,short defchar);
  504. short      _Cdecl getns(char *str,short maxchars);
  505. #if defined(__LINUX__)
  506. short      _Cdecl kbhit(void);
  507. #endif
  508. unsigned _Cdecl getxch(void);
  509. short      _Cdecl inputsf(char *str,char *fmt);
  510. void     _Cdecl kbclear(void);
  511. short      _Cdecl kbmhit(void);
  512. short      _Cdecl kbput(unsigned xch);
  513. short      _Cdecl kbputs(char *str);
  514. unsigned short _Cdecl kbstat(void);
  515. void     _Cdecl numoff(void);
  516. void     _Cdecl numon(void);
  517. short      _Cdecl scancode(short ch);
  518. short      _Cdecl setonkey(unsigned keycode,void (_Cdecl *func) (void),
  519.                          unsigned pass);
  520. short      _Cdecl waitkey(void);
  521. short      _Cdecl waitkeyt(short duration);
  522.  
  523. void       _Cdecl closevideo(void);
  524. short      _Cdecl cvaltype(short ch,short ctype);
  525. double   _Cdecl cvtcf(char *field,short wholesize,short fracsize);
  526. short      _Cdecl cvtci(char *field);
  527. void     _Cdecl cvtfc(char *field,double value,short wholesize,short fracsize);
  528. void     _Cdecl cvtic(char *field,short value,short size);
  529. short      _Cdecl strblank(char *str);
  530. char    *_Cdecl strbmatch(char *str,char *strarr[]);
  531. short      _Cdecl strchg(char *str,short oldch,short newch);
  532. unsigned long _Cdecl strchksum(char *str);
  533. char    *_Cdecl strcode(char *str,char *key);
  534. char    *_Cdecl strdel(char *substr,char *str);
  535. char    *_Cdecl strdela(char *substr,char *str);
  536. short      _Cdecl strichg(char *str,short oldch,short newch);
  537. unsigned long _Cdecl strichksum(char *str);
  538. char    *_Cdecl stridel(char *substr,char *str);
  539. char    *_Cdecl stridela(char *substr,char *str);
  540. char    *_Cdecl striinc(char *str1,char *str2);
  541. char    *_Cdecl strinc(char *str1,char *str2);
  542. char    *_Cdecl strins(char *instr,char *str,short st_pos);
  543. short      _Cdecl striocc(char *str,short ch);
  544. char    *_Cdecl strischg(char *str,char *find,char *replace);
  545. short      _Cdecl strisocc(char *str1,char *str2);
  546. char    *_Cdecl strisrep(char *str,char *search,char *replace);
  547. char    *_Cdecl strljust(char *str);
  548. char    *_Cdecl strltrim(char *str);
  549. short      _Cdecl strmatch(char *str1,char *str2);
  550. char    *_Cdecl strmid(char *str,short st_pos,short num_chars);
  551. short      _Cdecl strocc(char *str,short ch);
  552. char    *_Cdecl strrjust(char *str);
  553. char    *_Cdecl strrol(char *str,short count);
  554. char    *_Cdecl strror(char *str,short count);
  555. char    *_Cdecl strschg(char *str,char *find,char *replace);
  556. char    *_Cdecl strsetsz(char *str,short newsize);
  557. char    *_Cdecl strshl(char *str,short count);
  558. char    *_Cdecl strshr(char *str,short count);
  559. short      _Cdecl strsocc(char *str1,char *str2);
  560. //char    *_Cdecl strsrep(char *str,char *search,char *replace);
  561. char    *_Cdecl strtrim(char *str);
  562. char    *_Cdecl struplow(char *str);
  563. short      _Cdecl touplow(char *str,char *pos,short ch);
  564.  
  565. void     _Cdecl box_(short srow,short scol,short erow,short ecol,short btype,short attr);
  566. void     _Cdecl cclrscrn(short attr);
  567. short      _Cdecl cgardbyte(char *src);
  568. short      _Cdecl cgardword(short *src);
  569. void     _Cdecl cgareadn(short *src,short *dest,unsigned n);
  570. void     _Cdecl cgawrbyte(char *dest,short chr);
  571. void     _Cdecl cgawriten(short *src,short *dest,unsigned n);
  572. void     _Cdecl cgawrstr(char *dest,char *string,short attr);
  573. void     _Cdecl cgawrword(short *dest,short chratr);
  574. void     _Cdecl clreol_(void);
  575. void     _Cdecl clrscrn(void);
  576. short      _Cdecl disktoscrn(char *fname);
  577. short      _Cdecl disktowin(char *fname);
  578. void     _Cdecl fill_(short srow,short scol,short erow,short ecol,short ch,short atr);
  579. void     _Cdecl getcursz(short *sline,short *eline);
  580. void     _Cdecl gotoxy_(short row,short col);
  581. void     _Cdecl hidecur(void);
  582. void     _Cdecl lgcursor(void);
  583. short      _Cdecl mapattr(short attr);
  584. void     _Cdecl mode(short mode_code);
  585. void     _Cdecl printc(short row,short col,short attr,short ch);
  586. void     _Cdecl prints(short row,short col,short attr,char *str);
  587. void     _Cdecl putchat(short ch,short attr);
  588. unsigned _Cdecl readchat(void);
  589. void     _Cdecl readcur(short *row,short *col);
  590. void     _Cdecl revattr(short count);
  591. short      _Cdecl revsattr(short attr);
  592. short      _Cdecl scrntodisk(char *fname);
  593. void     _Cdecl setattr(short attr,short count);
  594. void     _Cdecl setcursz(short sline,short eline);
  595. short      _Cdecl setlines(short numlines);
  596. short      _Cdecl setvparam(short setting);
  597. void     _Cdecl showcur(void);
  598. void     _Cdecl smcursor(void);
  599. void     _Cdecl spc(short num);
  600. void     _Cdecl srestore(short *sbuf);
  601. short     *_Cdecl ssave(void);
  602. short      _Cdecl videoinit(void);
  603. void       _Cdecl videoupdate(void);
  604. short      _Cdecl vidmode(void);
  605. short      _Cdecl vidtype(void);
  606. short      _Cdecl wshortodisk(short srow,short scol,short erow,short ecol,char *fname);
  607.  
  608. short      _Cdecl wactiv(CXLWIN whandle);
  609. short      _Cdecl wborder(short btype);
  610. short      _Cdecl wbox(short wsrow,short wscol,short werow,short wecol,short btype
  611.                 ,short attr);
  612. short      _Cdecl wbprintc(short bord,short offs,short attr,short ch);
  613. short      _Cdecl wcclear(short attr);
  614. short      _Cdecl wcenters(short wrow,short attr,char *str);
  615. short      _Cdecl wchgattr(short battr,short wattr);
  616. short      _Cdecl wchkbox(short wsrow,short wscol,short werow,short wecol);
  617. short      _Cdecl wchkcol(short wcol);
  618. short      _Cdecl wchkcoord(short wrow,short wcol);
  619. short      _Cdecl wchkrow(short wrow);
  620. void       _Cdecl wclear(void);
  621. short      _Cdecl wclose(void);
  622. short      _Cdecl wcloseall(void);
  623. short      _Cdecl wclreol(void);
  624. short      _Cdecl wclreos(void);
  625. CXLWIN   _Cdecl wcopy(short nsrow,short nscol);
  626. short      _Cdecl wdelline(short wrow,short direc);
  627. short      _Cdecl wdrag(short direction);
  628. short      _Cdecl wdump(void);
  629. short      _Cdecl wdupc(short ch,short count);
  630. short      _Cdecl wdups(char *str,short count);
  631. char    *_Cdecl werrmsg(void);
  632. short      _Cdecl wfill(short wsrow,short wscol,short werow,short wecol,short ch,short attr);
  633. struct   _wrec_t *_Cdecl wfindrec(CXLWIN whandle);
  634. short      _Cdecl wgetc(void);
  635. short      _Cdecl wgetchf(char *valid,short defchar);
  636. short      _Cdecl wgetns(char *str,short maxchars);
  637. short      _Cdecl wgets(char *str);
  638. short      _Cdecl wgetyn(short cdefault);
  639. short      _Cdecl wgotoxy(short wrow,short wcol);
  640. CXLWIN   _Cdecl whandle(void);
  641. short      _Cdecl whelpcat(short cat);
  642. short      _Cdecl whelpclr(void);
  643. short      _Cdecl whelpdef(char *file,unsigned key,short winattr,short textattr,
  644.                          short selattr,short barattr,void (_Cdecl *open)(void));
  645. short      _Cdecl whelpop(void);
  646. short      _Cdecl whelpopc(void);
  647. short      _Cdecl whelppcat(short cat);
  648. short      _Cdecl whelpush(void);
  649. short      _Cdecl whelpushc(short cat);
  650. short      _Cdecl whelpwin(short srow,short scol,short erow,short ecol,short btype,
  651.                          short title);
  652. short      _Cdecl whide(void);
  653. short      _Cdecl whline(short wsrow,short wscol,short count,short btype,short attr);
  654. CXLWIN   _Cdecl windowat(short row,short col);
  655. short      _Cdecl winpbeg(short fieldattr,short textattr);
  656. short      _Cdecl winpdef(short wrow,short wcol,char *str,char *format,short fconv,short mode,short (*validate) (char *),short help);
  657. short      _Cdecl winpread(void);
  658. short      _Cdecl winputsf(char *str,char *fmt);
  659. short      _Cdecl winsline(short wrow,short direc);
  660. short      _Cdecl wmenubeg(short srow,short scol,short erow,short ecol,short btype,short battr,short wattr,void (*open)(void));
  661. short      _Cdecl wmenubegc(void);
  662. short      _Cdecl wmenuend(short taginit,short menutype,short barwidth,short textpos,
  663.                          short textattr,short scharattr,short noselattr,short barattr);
  664. short      _Cdecl wmenuget(void);
  665. struct   _item_t *_Cdecl wmenuicurr(void);
  666. short      _Cdecl wmenuidsab(short tagid);
  667. short      _Cdecl wmenuienab(short tagid);
  668. struct   _item_t *_Cdecl wmenuifind(short tagid);
  669. short      _Cdecl wmenuinext(short tagid);
  670. short      _Cdecl wmenuitem(short wrow,short wcol,char *str,short schar,short tagid,short fmask,void (*select)(void),unsigned hotkey,short help);
  671. short      _Cdecl wmenuitxt(short wrow,short wcol,short attr,char *str);
  672. short      _Cdecl wmessage(char *str,short border,short leftofs,short attr);
  673. short      _Cdecl wmove(short nsrow,short nscol);
  674. CXLWIN   _Cdecl wopen(short srow,short scol,short erow,short ecol,short btype,short battr,
  675.                       short wattr);
  676. short      _Cdecl wperror(char *message);
  677. short      _Cdecl wpgotoxy(short wrow,short wcol);
  678. char    *_Cdecl wpickfile(short srow,short scol,short erow,short ecol,short btype,
  679.                           short bordattr,short winattr,short barattr,short title,
  680.                           char *filespec,void (*open)(void));
  681. short      _Cdecl wpickstr(short srow,short scol,short erow,short ecol,short btype,
  682.                          short bordattr,short winattr,short barattr,char *strarr[],
  683.                          short initelem,void (*open)(void));
  684. short      _Cdecl wprintc(short wrow,short wcol,short attr,short ch);
  685. short      _Cdecl wprintf(const char *format,...);
  686. short      _Cdecl wprints(short wrow,short wcol,short attr,char *str);
  687. short      _Cdecl wprintsf(short wrow,short wcol,short attr,char *format,char *str);
  688. short      _Cdecl wputc(short ch);
  689. short      _Cdecl wputns(char *str,short width);
  690. short      _Cdecl wputs(char *str);
  691. short      _Cdecl wputsw(char *str);
  692. short      _Cdecl wreadcur(short *wrow,short *wcol);
  693. void     _Cdecl wrestore(short *wbuf);
  694. short      _Cdecl wrjusts(short wrow,short wjcol,short attr,char *str);
  695. short   *_Cdecl wsave(short srow,short scol,short erow,short ecol);
  696. short      _Cdecl wscanf(const char *format,...);
  697. short      _Cdecl wscroll(short count,short direc);
  698. short      _Cdecl wscrollbox(short wsrow,short wscol,short werow,short wecol,short count,
  699.                            short direction);
  700. short      _Cdecl wselstr(short wrow,short wcol,short attr,char *strarr[],
  701.                         short initelem);
  702. short      _Cdecl wshadoff(void);
  703. short      _Cdecl wshadow(short attr);
  704. short      _Cdecl wsize(short nerow,short necol);
  705. short      _Cdecl wslide(short nsrow,short nscol);
  706. short      _Cdecl wtextattr(short attr);
  707. short      _Cdecl wtitle(char *str,short tpos,short tattr);
  708. short      _Cdecl wunhide(CXLWIN whandle);
  709. short      _Cdecl wunlink(CXLWIN w);
  710. short      _Cdecl wvline(short wsrow,short wscol,short count,short btype,short attr);
  711. short      _Cdecl wwprints(CXLWIN whandle,short wrow,short wcol,short attr,char *str);
  712.  
  713. #ifdef __cplusplus
  714. }
  715. #endif
  716.  
  717. /*-----------------------[ macro-function definitions ]----------------------*/
  718.  
  719. #undef MK_FP
  720. #if defined(__DOS__)
  721. #if defined (__386__)
  722. #define MK_FP(seg,ofs)      ((void *) (((unsigned long)(seg) << 4) | (unsigned)(ofs)))
  723. #else
  724. #define MK_FP(seg,ofs)      ((void *) (((unsigned long)(seg) << 16) | (unsigned)(ofs)))
  725. #endif
  726. #elif defined(__LINUX__) || defined(__OS2__) || defined(__NT__)
  727. #define MK_FP(seg,ofs)      ((void *) (seg + ofs))
  728. #endif
  729. #define attrib(f,b,i,bl)    ((b<<4)|(f)|(i<<3)|(bl<<7))
  730. #define clrwin(a,b,c,d)     gotoxy_(a,b);fill_(a,b,c,d,' ',(readchat()>>8))
  731.  
  732. #define strbtrim(st)        strtrim(strltrim(st))
  733. #define strleft(st,nu)      strmid(st,0,nu)
  734. #define strright(st,nu)     strmid(st,strlen(st)-nu,nu)
  735. #define strrtrim(st)        strtrim(st)
  736.  
  737. #define wfillch(a)          (_winfo.fillch=a)
  738. #define whelpundef()        whelpdef(NULL,0,0,0,0,0,NULL)
  739. #define winpfcurr()         (_winfo.active->form->cfield)
  740. #define wisactiv(a)         (a==_winfo.active->whandle)
  741. #define wmenumcurr()        (_winfo.cmenu)
  742. #define wsetesc(a)          (_winfo.esc=a)
  743. #define wtabwidth(a)        (_winfo.tabwidth=((a==0)?1:a))
  744.  
  745. #endif
  746.  
  747.  
  748.