CXL Quick Reference ------------------- CXLDEF.H - Miscellaneous Functions ---------------------------------- void beep(void); Sounds a beep in the speaker. char *biosver(void); Returns the ROM BIOS version date. int clockcal(void); Determines if a clock-calendar board is installed. char *cxlver(void); Returns the CXL version number of the current CXL library in use. void delay_(unsigned duration); Delays program execution for a specified duration. unsigned expmem(void); Determines the amount, if any, of expanded memory on the system. unsigned extmem(void); Determines the amount of extended memory on an AT-class machine. int fcrypt(char *file,char *key); Encrypts or decrypts a text or binary file. int gameport(void); Determines if a game port is installed. int machid(void); Returns the value of the machine ROM ID byte. int mathchip(void); Determines if a math coprocessor is installed. int numflop(void); Returns the number of floppy disk drives installed. int numpar(void); Returns the number of parallel ports. int numser(void); Returns the number of serial ports installed. char *randfile(void); Creates a random file name. void sound_(unsigned pitch,unsigned duration); Sounds a tone of specified pitch and duration. char *sysdate(int dtype); Returns a string containing the current system date. 1 char *systime(int ttype); Returns a string containing the current system time. int tabstop(int col,int tabwidth); Calculates a tab stop from given column and tab width. unsigned long timer(void); Returns the value of the BIOS timer. 2 CXLEMS.H - Expanded Memory Functions ------------------------------------ int emsalloc(int numpages); Allocates pages of EMS memory. int emsdealloc(int handle); Deallocates previously allocated pages of EMS memory. int emsexist(void); Determines if the EMS device driver is loaded. unsigned emsframe(void); Returns the EMS page frame base segment address. unsigned emsfree(void); Returns the number of free EMS pages (16K blocks). int emsmap(int handle,int lpage,int ppage); Maps a logical page of EMS memory onto a physical page address. int emsread(char *dest,unsigned emsofs,unsigned numbytes); Reads bytes from one or more pages of allocated EMS memory. unsigned emstotal(void); Returns the total number of EMS memory pages (16K blocks) on the system. char *emsver(void); Returns the version of the EMS driver in use. int emswrite(char *src,unsigned emsofs,unsigned numbytes); Writes bytes to one or more pages of EMS memory. 3 CXLKEY.H - Keyboard Functions ----------------------------- void capsoff(void); Toggles the CapsLock key off. void capson(void); Toggles the CapsLock key on. struct _onkey_t *chgonkey(struct _onkey_t *list); Changes the defined onkey list pointer. void clearkeys(void); Clears the keyboard buffer. void freonkey(void); Frees all active onkey definitions from memory. int getchf(char *valid,int defchar); Gets a character from the keyboard from a list of valid characters. int getns(char *str,int maxchars); Inputs a string of a specified maximum length from the keyboard. unsigned getxch(void); Gets a key (ASCII code/scan code) from the keyboard. int inputsf(char *str,char *fmt); Inputs a formatted string from the keyboard. void kbclear(void); Clears CXL's internal keyboard buffer. int kbmhit(void); Determines if a key has been pressed and is waiting to be got. int kbput(unsigned xch); Places a keystroke into CXL's internal keyboard buffer. int kbputs(char *str); Places a string of characters into CXL's internal keyboard buffer. unsigned kbstat(void); Returns the status of the keyboard control keys. void numoff(void); Toggles the NumLock key off. void numon(void); Toggles the NumLock key on. int scancode(int ch); Returns the common scan code of the specified character. void setkbloop(void (*func)(void)); Specifies a function to be called during keyboard wait periods. 4 int setonkey(unsigned keycode,void (*func) (void),unsigned pass); Attaches/detaches a keypress to a function call. int waitkey(void); Clears the keyoard buffer and halts the program until a key is pressed. int waitkeyt(int duration); Clears the keyboard buffer and halts the program until a key press, or the specified time limit expires. 5 CXLMOU.H - Mouse Functions -------------------------- void msbclear(void); Clears the mouse driver's button counters. void msbpress(int button,int *bstat,int *bcount,int *row,int *col); Returns information about the specific button presses of mouse. void msbreles(int button,int *bstat,int *bcount,int *row,int *col); Returns informmation about specific button releases of mouse. void mscondoff(int srow,int scol,int erow,int ecol); Conditionally hides the mouse cursor. void mscursor(unsigned curtype,unsigned smask,unsigned cmask); Sets the mouse text cursor type. void msgotoxy(int row,int col); Sets the mouse cursor coordinates. void mshbounds(int leftcol,int rightcol); Sets the mouse's upper and lower horizontal bounds. void mshidecur(void); Hides the mouse cursor. int msinit(void); Determines if a mouse is present. If so, initializes it. void msmotion(int *rowcount,int *colcount); Gets information about the movement of the mouse. void msshowcur(void); Reveals the hidden mouse cursor. void msspeed(int xratio,int yratio); Adjusts the mouse's speed by changing its sensitivity. void msstatus(int *bstat,int *row,int *col); Returns the status of the mouse. void mssupport(int type); Selects the type of mouse support to be used by CXL functions. void msvbounds(int toprow,int botrow); Sets the mouse's left and right vertical bounds. 6 CXLPRN.H - Printer Functions ----------------------------- void lcrlf(void); Prints a carriage return and line feed on the printer (PRN). void lprintc(int ch); Prints a character on the printer (PRN). void lprintf(const char *format,...); Sends formatted output to the printer (PRN). void lprintns(char *str,int width); Prints a string to a fixed width on the printer (PRN). void lprints(char *str); Prints a string on the printer (PRN). void lprintsb(char *str,int reps); Prints a bold-faced string on the printer (PRN). void lprintsu(char *str); Prints an underlined string on the printer (PRN). void scrndump(void); Dumps the current screen to the printer (PRN). void windump(int srow,int scol,int erow,int ecol); Dumps a screen window to the printer (PRN). 7 CXLSTR.H - String Functions --------------------------- int cvaltype(int ch,int ctype); Checks given character against a given CXL character type code. double cvtcf(char *field,int wholesize,int fracsize); Converts a CXL field string to a floating point number. int cvtci(char *field); Converts a CXL field string to an integer. void cvtfc(char *field,double value,int wholesize,int fracsize); Converts a floating point number to a CXL field string. void cvtic(char *field,int value,int size); Converts an integer to a CXL field string. int strblank(char *str); Determines if a given string is blank (whitespace). char *strbmatch(char *str,char *strarr[]); Returns the best match of a string in an array of strings. char *strbtrim(char *str); Trims both leading and trailing spaces off of a string. int strchg(char *str,int oldch,int newch); Finds matching characters in a string & replaces them with another. unsigned long strchksum(char *str); Returns the checksum of a string. char *strcode(char *str,char *key); Encrypts/decrypts a string. char *strdel(char *substr,char *str); Deletes a substring from within a string. char *strdela(char *substr,char *str); Deletes all occurrences of a substring from within a string. int strichg(char *str,int oldch,int newch); Finds matching characters in a string & replaces them with another. Case insensitive. unsigned long strichksum(char *str); Returns the checksum of a string. Lowercase letters count as uppercase. char *stridel(char *substr,char *str); Deletes a substring from within a string. Case insensitive. char *stridela(char *substr,char *str); Deletes all occurrences of a substring from a string. Case insensitive. char *striinc(char *str1,char *str2); 8 Determines if/where one string is included in another. Case insensitive. char *strinc(char *str1,char *str2); Determines if and where one string is included within another. char *strins(char *instr,char *str,int st_pos); Inserts one string into another. int striocc(char *str,int ch); Returns number of occurrences of character in string. Case insensitive. char *strischg(char *str,char *find,char *replace); Changes all occurrences of one string to another. Case insensitive. int strisocc(char *str1,char *str2); Counts occurrences of one string within another. Case insensitive. char *strisrep(char *str,char *search,char *replace); Searches for, and replaces one string within another. Case insensitive. char *strleft(char *str,int num_chars); Takes a portion of a string from its left, creating a new string. char *strljust(char *str); Left justifies a text string. char *strltrim(char *str); Trims the leading spaces off of a string. int strmatch(char *str1,char *str2); Compares 2 strings and returns a match score. char *strmid(char *str,int st_pos,int num_chars); Takes a portion from the middle of a string, creating a new string. int strocc(char *str,int ch); Returns the number of occurrences of a given character in a string. char *strright(char *str,int num_chars); Takes a portion from the right side of a string, creating a new string. char *strrjust(char *str); Right justifies a text string. char *strrol(char *str,int count); Rotates a string specified number of characters left. char *strror(char *str,int count); Rotates a string specified number of characters right. char *strschg(char *str,char *find,char *replace); Changes all occurrences of one string to another. char *strsetsz(char *str,int newsize); Adjusts length of a string, either by truncation or padding with spaces. char *strshl(char *str,int count); 9 Shifts a string a specified number of characters left. char *strshr(char *str,int count); Shifts a string a specified number of characters right. int strsocc(char *str1,char *str2); Counts the occurrences of one string within another. char *strsrep(char *str,char *search,char *replace); Searches for, and replaces one string within another. char *strtrim(char *str); Trims trailing spaces off of a string. char *struplow(char *str); Converts a string to mixed upper & lowercase characters. int touplow(char *str,char *pos,int ch); Converts a character to upper/lowercase depending on previous character. 10 CXLVID.H - Video Functions -------------------------- int attrib(int fore,int back,int bright,int blink); Creates a text attribute. void box_(int srow,int scol,int erow,int ecol,int btype,int attr); "Draws" a text box on the screen. void cclrscrn(int attr); Clears the screen using given text attribute and homes the cursor. int cgardbyte(char far *src); Reads a byte from CGA video memory without snow. int cgardword(int far *src); Reads a word from CGA video memory without snow. void cgareadn(int far *src,int *dest,unsigned n); Reads n words from CGA video memory without snow. void cgawrbyte(char far *dest,int chr); Writes a byte to CGA video memory without snow. void cgawriten(int *src,int far *dest,unsigned n); Writes n words to CGA video memory without snow. void cgawrstr(char far *dest,char *string,int attr); Writes a string to CGA video memory without snow. void cgawrword(int far *dest,int chratr); Writes a word to CGA video memory without snow. void clreol_(void); Clears to the end of line using the text attribute under the cursor. void clrscrn(void); Clears the screen and homes the cursor. void clrwin(int srow,int scol,int erow,int ecol); Clears a window of the screen. int disktoscrn(char *fname); Copies a previously saved screen disk file to the screen. int disktowin(char *fname); Copies a previously saved window disk file to the screen. void fill_(int srow,int scol,int erow,int ecol,int ch,int attr); Fills in a region of the screen with a specified character/attribute. void getcursz(int *sline,int *eline); Returns the start and stop scan lines of cursor. void gotoxy_(int row,int col); Sets cursor coordinates on the screen. 11 void hidecur(void); Hides the cursor. void lgcursor(void); Makes the cursor large. int mapattr(int attr); Translates a color text attribute into its monochrome equivalent. void mode(int mode_code); Sets the video mode. void printc(int row,int col,int attr,int ch); Displays a character to the screen at a specified location. void prints(int row,int col,int attr,char *str); Displays a string on the screen at a specified location. void putchat(int ch,int attr); Puts a character/attribute on the screen at current cursor position. unsigned readchat(void); Reads the character and attribute under the cursor. void readcur(int *row,int *col); Reads the current cursor location. void revattr(int count); Reverses the attribute of the character under the cursor. int revsattr(int attr); Returns the inverse of the given text attribute. int scrntodisk(char *fname); Copies the current screen to a disk file. void setattr(int attr,int count); Sets the attribute of the character under the cursor. void setcursz(int sline,int eline); Sets the cursor size. This function is video adapter dependent. int setlines(int numlines); Sets the number of lines on the display. int setvparam(int setting); Sets video display parameters. void showcur(void); Reveals the hidden cursor, restoring it to its previous shape. void smcursor(void); Makes the cursor small. void spc(int num); Displays a specified number of spaces to the screen. 12 void srestore(int *sbuf); Restores a previously saved screen. int *ssave(void); Saves the current screen to a buffer. int videoinit(void); Initializes CXL's video system. int vidmode(void); Returns the current video display mode. int vidtype(void); Determines the display adapter type. int wintodisk(int srow,int scol,int erow,int ecol,char *fname); Copies a window of the screen to a disk file. 13 CXLWIN.H - Windowing Functions ------------------------------ int wactiv(WINDOW whandle); Activates a previously opened window, bringing it in front. int wborder(int btype); Changes the active window's border box type. int wbox(int wsrow,int wscol,int werow,int wecol,int btype,int attr); "Draws" a text box in the active window. int wbprintc(int bord,int offs,int attr,int ch); Displays a character on a window's border. int wcclear(int attr); Clears the active window using specified text attribute, homes cursor. int wcenters(int wrow,int attr,char *str); Displays a string centered in active window. int wchgattr(int battr,int wattr); Changes the text attribute of the active window. int wchkbox(int wsrow,int wscol,int werow,int wecol); Checks validity of given window box coordinates. int wchkcol(int wcol); Checks validity of given window column coordinate. int wchkcoord(int wrow,int wcol); Checks validity of given window row,column coordinates. int wchkrow(int wrow); Checks validity of given window row coordinate. int wclear(void); Clears the active window, then homes the cursor. int wclose(void); Closes the active window. int wcloseall(void); Closes all open windows. int wclreol(void); Clears from the cursor to the end of the active window's line. int wclreos(void); Clears from the cursor to the end of the active window. int wcopy(int nsrow,int nscol); Creates a new window duplicating the active window. int wdelline(int wrow,int direc); Deletes a line from the active window. 14 int wdrag(int direction); Smoothly drag active window one row/column in given direction. int wdump(void); Dumps the active window to the default printer (PRN). int wdupc(int ch,int count); Displays a character a specified number of times in active window. int wdups(char *str,int count); Displays a string a specified number of times in the active window. char *werrmsg(void); Returns a literal representation of the error message from the last windowing function. int wfill(int wsrow,int wscol,int werow,int wecol,int ch,int attr); Fills in a region of active window with a specified character/attribute. void wfillch(int ch); Specifies character the windowing system will use for filling windows. struct _wrec_t *wfindrec(WINDOW whandle); Finds the address of a window record using the specified window handle. int wgetc(void); Gets a character from the keyboard from within active window. int wgetchf(char *valid,int defchar); Gets character from valid list from keyboard from within active window. int wgetns(char *str,int maxlen); Gets a limited-length string from keyboard from within active window. int wgets(char *str); Gets a string from the keyboard from within the active window. int wgetyn(int cdefault); Gets a [Y]es or [N]o response from the keyboard. int wgotoxy(int wrow,int wcol); Sets cursor coordinates within the active window. WINDOW whandle(void); Returns the window handle of the active window. int whelpcat(int cat); Sets the current help category. int whelpclr(void); Clears the help category stack. int whelpdef(char *file,unsigned key,int winattr,int textattr, int selattr,int barattr,void (*open)(void)); Defines the help file, key, and window colors. 15 int whelpop(void); Pops the help category off of the top of the stack and makes it current. int whelpopc(void); Pops the help category off of the top of the stack and into the void. int whelppcat(int cat); Pushes the current help category onto the stack, then sets it to value. int whelpush(void); Pushes the current help category onto the help category stack. int whelpushc(int cat); Pushes the specified help category onto the help category stack. The current help category is not affected. The stack can hold up to 20 help categories. int whelpundef(void); Disengages the help sytem. int whelpwin(int srow,int scol,int erow,int ecol,int btype,int title); Sets specific features to be used by help window for when it is opened. int whide(void); Hides the active window. The next window becomes active. int whline(int wsrow,int wscol,int count,int btype,int attr); "Draws" a horizontal text line in active window. WINDOW windowat(int row,int col); Returns the handle of the window at given screen row,column coordinates. int winpbeg(int fieldattr,int textattr); Marks the beginning of a data input form. int winpdef(int wrow,int wcol,char *str,char *format,int fconv,int mode, int (*validate) (char *),int help); Defines a window input field. int winpfba(void (*before)(void),void (*after)(void)); Assigns "before" and "after" function pointers to an input field. struct _field_t *winpfcurr(void); Returns the address of the current input field's record. struct _field_t *winpffind(int wrow,int wcol); Searches for a defined input field and returns address of its record. int winpkey(unsigned (*getkey)(int *),unsigned *termkey); Defines alternate keyboard support for multi-field input forms. int winpread(void); Marks the end of the defined input form and initiates processing of it. int winputsf(char *str,char *fmt); Inputs a formatted string from the keyboard from within active window. 16 int winsline(int wrow,int direc); Inserts a blank line in the active window. int wisactiv(WINDOW whandle); Determines if the specified window is active. int wmenubeg(int srow,int scol,int erow,int ecol,int btype,int battr, int wattr,void (*open)(void)); Starts a menu/sub-menu definition. int wmenubegc(void); Starts a menu/sub-menu definition for menus to assume the active window. int wmenuend(int taginit,int menutype,int barwidth,int textpos, int textattr,int scharattr,int noselattr,int barattr); Ends a menu/sub-menu definition. int wmenuget(void); Processes the defined menu structure. int wmenuiba(void (*before)(void),void (*after)(void)); Assigns "before" and "after" function pointers to a menu item. struct _item_t *wmenuicurr(void); Returns the address of the current menu item's record. int wmenuidsab(int tagid); Disables a menu item by making it nonselectable. int wmenuienab(int tagid); Enables a disabled menu item for selection. struct _item_t *wmenuifind(int tagid); Searches the menu structure for the address of a menu item's record. int wmenuinext(int tagid); Sets which menu item to position bar at upon return from function call. int wmenuitem(int wrow,int wcol,char *str,int schar,int tagid,int fmask, void (*select)(void),unsigned hotkey,int help); Defines a menu item. int wmenuitxt(int wrow,int wcol,int attr,char *str); Adds a text description to a menu item. struct _menu_t *wmenumcurr(void); Returns the address of the currently active menu's record. int wmessage(char *str,int border,int leftofs,int attr); Displays text on the top or bottom border of the active window. int wmove(int nsrow,int nscol); Moves the active window to a new location on the screen. WINDOW wopen(int srow,int scol,int erow,int ecol,int btype,int battr, int wattr); Opens a screen window and makes it active. 17 int wperror(char *message); Opens an error window and displays an error message. int wpgotoxy(int wrow,int wcol); Sets cursor coordinates within the active window, wrapping if needed. char *wpickfile(int srow,int scol,int erow,int ecol,int btype, int bordattr,int winattr,int barattr,int title, char *filespec,void (*open)(void)); Opens up a file picking window and allows user to select a file. int wpickstr(int srow,int scol,int erow,int ecol,int btype,int bordattr, int winattr,int barattr,char *strarr[],int initelem, void (*open)(void)); Opens up a string picking window and allows user to select a string. int wprintc(int row,int col,int attr,int ch); Displays a character in the active window. int wprintf(const char *format,...); Outputs a formatted string to the active window. int wprints(int wrow,int wcol,int attr,char *str); Displays a string in the active window. int wprintsf(int wrow,int wcol,int attr,char *format,char *str); Displays a string to active window using a CXL format string. int wputc(int ch); Displays a character in the active window at current cursor position. int wputns(char *str,int width); Displays a string in the active window at the current cursor position. Number of characters output will be determined by input width. int wputs(char *str); Displays a string in the active window at the current cursor position. int wputsw(char *str); Displays a string in active window at the current cursor position. Words will be wrapped around to the next line if necessary. int wreadcur(int *wrow,int *wcol); Reads the current cursor coordinates of the active window. void wrestore(int *wbuf); Restores a previously saved region of the screen screen. int wrjusts(int wrow,int wjcol,int attr,char *str); Displays a string right justified to specified column in active window. int *wsave(int srow,int scol,int erow,int ecol); Saves a region of the screen. int wscanf(const char *format,...); Inputs a formatted string from keyboard from within active window. 18 int wscroll(int count,int direc); Scrolls text lines within the active window, up or down. int wscrollbox(int wsrow,int wscol,int werow,int wecol,int count, int direc); Scrolls a region of the active window up or down. int wselstr(int wrow,int wcol,int attr,char *strarr[],int initelem); Allows user to select one string from an array via an in-place "menu". void wsetesc(int option); Sets the Escape checking status for window keyboard input functions. int wshadoff(void); Removes the shadow from the active window, if one exists. int wshadow(int attr); Gives the active window a shadow. int wsize(int nerow,int necol); Adjusts the size of the active window. int wslide(int nsrow,int nscol); Smoothly slides active window to new screen position. void wtabwidth(int tabwidth); Modifies the tab width to be used when displaying tabs in windows. int wtextattr(int attr); Sets the current text attribute for the active window. int wtitle(char *str,int tpos,int tattr); Gives active window a title. int wunhide(WINDOW whandle); Unhides a previously hidden window. int wunlink(WINDOW whandle); Unlinks a window, and frees all memory allocated by it. int wvline(int wsrow,int wscol,int count,int btype,int attr); "Draws" a vertical text line in the active window. int wwprints(WINDOW whandle,int wrow,int wcol,int attr,char *str); Prints a string to the specified window, which can be hidden or blocked. 19