home *** CD-ROM | disk | FTP | other *** search
-
- MICROFIRM FUNCTION LIBRARY QUICK REFERENCE GUIDE
-
- Copyright 1988-89 by Robert B. Stout dba MicroFirm
-
-
- *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
- * MFLFILES.H *
- *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
-
-
- **********************************************************
- * Check for the existance of a file *
- **********************************************************
-
- int exists(char *);
- See if a file exists
-
- **********************************************************
- * Change/verify disk drives or directories *
- **********************************************************
-
- int chdrv(char);
- Change disk drives
-
- LOGICAL drvalid(char);
- See if a drive is valid
-
- char getdrv(void);
- Return default drive
-
- int pushdir(char *);
- Save current directory, then go to a new one
-
- int popdir(void);
- Return to previous directory
-
- **********************************************************
- * File operations using FCB functions *
- **********************************************************
-
- int FCB_creat(char *, int);
- Create a file using a file control block
-
- int FCB_kill(char *, int);
- Delete a file using a file control block
-
- struct XFCB * FCB_open(char *, int);
- Open a file using a file control block
-
- int FCB_close(struct XFCB *);
- Close a file using a file control block
-
- int FCB_reads(struct XFCB *, void *);
- Sequential read using a file control block
-
- int FCB_writes(struct XFCB *, void *);
- Sequential write using a file control block
-
- int FCB_readr(struct XFCB *, void *, long);
- Random read using a file control block
-
- int FCB_writer(struct XFCB *, void *, long);
- Random write using a file control block
-
- **********************************************************
- * Manipulate volume labels *
- **********************************************************
-
- char *flretvol(char);
- Return volume label for a specified drive
-
- int flremvol(char);
- Remove volume label for a specified drive
-
- int flsetvol(char, char *);
- Set volume label for a specified drive
-
- **********************************************************
- * Delete files using FCB's - very fast with wildcards! *
- **********************************************************
-
- int del_files(char *, char *);
- Delete all files matching a spec in a given directory
-
- **********************************************************
- * Copy files *
- **********************************************************
-
- int fcopy(char *, char *, int);
- Copy one file to another with overwrite control
-
- **********************************************************
- * Expand command line wildcard arguments *
- **********************************************************
-
- extern char **nargv;
- int expand_args(int, char *[]);
- Expand command line arguments
-
- **********************************************************
- * Directory operations using file-type functions *
- **********************************************************
-
- DOS_DIR * opendir(char *);
- Open a directory for reading
-
- void closedir(DOS_DIR *);
- Close a directory
-
- struct FIND * readdir(DOS_DIR *);
- Read directory entries
-
- int dirmask(struct FIND *, char *, char *, unsigned, unsigned);
- Validates directory entries based on name and attributes
-
- **********************************************************
- * Stream functions for installable stream filters. *
- **********************************************************
-
- SFILE * sfopen(char *, char *);
- Open a file as a filterable stream
-
- SFILE * scopen(int (*)(), int (*)(), char *);
- Open a channel as a filterable stream
-
- int sfclose(SFILE *);
- Close an open stream
-
- int sfputc(int, SFILE *);
- Put a character to a stream
-
- int sfputs(char *, SFILE *);
- Put a string to a stream
-
- size_t sfwrite(void *, size_t, size_t, SFILE *);
- Write a buffer to a stream
-
- int sfgetc(SFILE *);
- Get a character from a stream
-
- char * sfgets(void *, int, SFILE *);
- Get a string from a stream
-
- size_t sfread(void *, size_t, size_t, SFILE *);
- Read a buffer from a stream
-
- LOGICAL sfinstall(SFILE *, SFILTER *);
- Install a stream filter
-
- **********************************************************
- * Simple stream filters *
- **********************************************************
-
- extern SFILTER ucase_filt,
- Forces a stream to upper case
-
- extern SFILTER lcase_filt;
- Forces a stream to lower case
-
- **********************************************************
- * Stream encryption function *
- **********************************************************
-
- int crypt_install(SFILE *, char *, int);
- Installs an encryption/decryption filter
-
- **********************************************************
- * Stream compression/expansion functions *
- **********************************************************
-
- int ncode_install(SFILE *);
- Installs an RLE encoder as a stream filter
-
- int dcode_install(SFILE *);
- Installs an RLE decoder as a stream filter
-
- **********************************************************
- * File truncation functions *
- **********************************************************
-
- int trunc(int, long);
- Truncate an open'ed file
-
- int ftrunc(FILE *, long);
- Truncate an fopen'ed file
-
- int truncate(char *, long);
- Truncate a named file
-
- **********************************************************
- * Filename parsing functions *
- **********************************************************
-
- int fnsplit(char *,char *,char *,char *,char *,char *,char *);
- Split a string into drive/path/file/ext
-
- char * fnmerge(char *,char *,char *,char *,char *,char *,char *);
- Merge drive/path/file/ext into a file string
-
- int has_wild(char *);
- Checks a string for DOS wildcards
-
- int wildname(char *, char *, int);
- Matches filenames against a pattern
-
- **********************************************************
- * Normalize file names *
- **********************************************************
-
- int flnorm(char *, char *);
- Normalize a filename
-
- char * fln_fix(char *);
- Remove "dot" directories from pathnames
-
- char * unix2dos(char *);
- Converts Unix-style paths to DOS-style
-
- **********************************************************
- * Open files using a path specification *
- **********************************************************
-
- FILE * fopenp(char *, char *);
- fopen a file in the PATH
-
- FILE * fopeng(char *, char *, char *);
- fopend/fopenp combination
-
- FILE * fopend(char *, char *, char *);
- Fopen a file in an environment variable
-
- int openp(char *, int);
- Open a file in the PATH
-
- int opend(char *, int, char *);
- Open a file in the PATH
-
- int openg(char *, int, char *);
- opend/openp combination
-
- int getpath(char *);
- Retrieve the PATH variable and parse
-
- **********************************************************
- * File extension functions *
- **********************************************************
-
- void badext(char *);
- Report invalid filename extension and exit
-
- void newext(char *, char *, char *);
- Change a filename extension
-
- int exttyp(char *, char *);
- Check a filename for a particular extension
-
- **********************************************************
- * Miscellaneous functions *
- **********************************************************
-
- void eraok(char *);
- Ask permission before overwriting existing file
-
- void cant(char *);
- Report inability to open a file and exit
-
- void exit2dos(void);
- Permission to exit program
-
- int repchar(char, int, FILE *);
- Repeat a character n times to fd
-
- int iscons(FILE *);
- Is file descriptor the console
-
-
- *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
- * MFLCONIO.H *
- *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
-
-
- **********************************************************
- * Translate video attribute to ANSI.SYS command *
- **********************************************************
-
- char * make_ansi(int);
- Translate video attributes to ANSI strings
-
- void Bputs(char *);
- Write a string using BIOS only
-
- **********************************************************
- * Direct video package *
- **********************************************************
-
- void dvid_init(void);
- Initialize the direct video package
-
- void dvid_bios(void);
- Use BIOS services rather than direct screen access
-
- void dvid_sync(int);
- Avoid show on CGA monitors
-
- void dvid_raw(int);
- Set control character translation mode
-
- void dvid_done(void);
- Close the direct video package
-
- void dvid_putchr(char);
- Place a character on the screen
-
- void dvid_putstr(char *);
- Plase a string on the screen
-
- void dvid_scroll(int, int, int, int, int, int);
- Scroll a region of the screen
-
- void dvid_move(int, int);
- Move the direct video internal cursor
-
- void dvid_setcount(int);
- Set repeat count for dvid_putchr()
-
- void dvid_flush(void);
- Update the screen, merge the internal and PC cursors
-
- void dvid_e2eol(void);
- Erase screen to end of line
-
- void dvid_e2eos(void);
- Erase screen to end of screen
-
- void dvid_attrib(int);
- Set direct video attribute (color)
-
- void dvid_setpage(int, int);
- Set direct video page
-
- void dvid_chgattrib(int, int, int, int, int);
- Change the attribute (color) for a region of the screen
-
- void dvid_cls(void);
- Clear the display and home cursor
-
- void dvid_clrfield(int, int, int);
- Clear a screen field
-
- void dvid_say(int, int, char *);
- Display a string at specified position
-
- void dvid_sayr(int, int, char *);
- Like dvid_say(), returns cursor to starting point
-
- void dvid_enterfn(char *, int, int, int, int);
- Enter a filename from keyboard
-
- void dvid_char_at(int, int, char);
- Display character at specified position
-
- void dvid_char_atr(int, int, char);
- Like dvid_char_at(), returns cursor to start
-
- void dvid_putsa(char *, int);
- Display a string with attribute
-
- int dvid_printf(char *, ...);
- Write a formatted string to the screen
-
- int dvid_printfa(int, char *, ...);
- Write a formatted string to the screen using specifed attrbiute
-
- int dvid_getchr(int, int);
- Retrieve a character from the screen
-
- int dvid_enterdata(char *, int, int, int, int);
- Enter a string of data from keyboard
-
- int dvid_getattr(void);
- Gets the current screen attribute
-
- int dvid_getraw(void)
- Gets the current control charatcer translation mode
-
- **********************************************************
- * Keyboard functions *
- **********************************************************
-
- void setcaps(void);
- Set the capslock status ON
-
- void clrcaps(void);
- Sets Caps lock to OFF
-
- void setnumlock(void);
- Sets numlock status ON
-
- void clrnumlock(void);
- Sets numlock status OFF
-
- int getkey(void);
- Extended keyboard fetch
-
- int kbstatus(int);
- Returns specified keyboard status flag
-
- int _kbstate(void);
- Returns keyboard status
-
- **********************************************************
- * Data entry functions functions *
- **********************************************************
-
- void enterfn(char *, int, int, int, int);
- Enter a filename from keyboard
-
- int enterdata(char *, int, int, int, int);
- Enter a string of data from keyboard
-
- **********************************************************
- * Console control and information functions *
- **********************************************************
-
- void viscroll(int, int, int, int, int, int, int);
- Scrolls the video display up or down
-
- void vidpage(int);
- Set a video page as active page
-
- void vid_border(int);
- Set border color
-
- void vid_palette(int);
- Set color palette
-
- void cursor_style(int, int, int);
- Alter the cursor style
-
- void vmode(int);
- Set video mode
-
- void v_init(void);
- Gets information on video system
-
- int iscons(FILE *);
- Is file descriptor the console
-
- int _stuff(void);
- Get equipment report (low level)
-
- int stuff(int);
- Get equipment report (high level)
-
- unsigned int getpos(int);
- Get current cursor position
-
- **********************************************************
- * Miscellaneous video functions *
- **********************************************************
-
- void error(char *);
- Report a fatal error and exit
-
- void cls(void);
- Clear screen and home cursor
-
- void clrfield(int, int, int, int);
- Clear a screen field through BIOS
-
- void d_cls(void);
- Clear current screen
-
- void d_pos(int, int, int);
- Position the cursor on a video page
-
- void d_say(int, int, char *);
- Display a string at a specific position
-
- void d_saypag(int, int, char *, int);
- Display a string at a specific position with page specification
-
- void mkbox(int, int, int, int, int);
- Make a box on the screen
-
- void vid_wrpix(int, int, int);
- Write a pixel to the screen
-
- int vid_rdpix(int, int);
- Read a pixel from the screen
-
-
- *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
- * MFLOCALE.H *
- *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
-
-
- **********************************************************
- * ANSI-compliant internationalization functions. *
- **********************************************************
-
- char *setlocale(int, const char *);
- Set a locale for a region
-
- struct lconv localeconv(void);
- Retrieve the current active locale information
-
-
- *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
- * MFLTIME.H *
- *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
-
-
- **********************************************************
- * Microsecond accuracy timing operations. *
- **********************************************************
-
- uclock_t usec_difftime(start,finish)
- Calculate the difference between two times
-
- uclock_t usec_clock(void);
- Read the system clock in microseconds
-
- void restart_uclock(void);
- Re-initialize the microsecond clock
-
- uclock_t usec_delay(uclock_t);
- Delay a given number of microseconds
-
- LOGICAL usec_timeout(uclock_t, uclock_t, uclock_t);
- Test for a timeout condition
-
- void msec_pause(long);
- Delay a given number of milliseconds
-
- **********************************************************
- * ANSI function to convert time to a string *
- **********************************************************
-
- size_t strftime(char *, size_t, const char *, const struct tm *);
- Convert data in tm structure to a string
-
- **********************************************************
- * Julian (scalar) date functions *
- **********************************************************
-
- long ymd_to_julian (unsigned, unsigned, unsigned);
- Convert year, month, date to Julian date
-
- void julian_to_ymd (long, unsigned *, unsigned *, unsigned *);
- Convert Julian date to year, month, date
-
- int julian_to_wkday(long);
- Convert Julian date to day of the week
-
- char * julian_to_dayname(long);
- Convert Julian date to day of the week
-
- unsigned julian_to_yrday(long);
- Convert Julian date to day of the year
-
- LOGICAL julian_to_time(long, time_t *);
- Convert Julian date to time_t value
-
- LOGICAL julian_to_tm(long, struct tm *);
- Convert Julian date to tm structure
-
- long time_to_julian(time_t);
- Convert time_t value to Julian date
-
- long tm_to_julian(struct tm *);
- Convert tm structure to Julian date
-
- **********************************************************
- * Access file dates and time *
- **********************************************************
-
- int getftime(int, struct ftime *);
- Get a file's time/date stamp
-
- int setftime(int, struct ftime *);
- Set a file's time/date stamp
-
- int touch(char *);
- Set file time/date stamp to the current time
-
- void get_filetime(struct tm *, int);
- Get file date/time stamp
-
- **********************************************************
- * Misc time functions *
- **********************************************************
-
- void installtick(int *);
- Install timer interrupt service routine
-
- void removetick(void);
- Remove timer interrupt service routine
-
- void gtodsub(FILE *);
- Get time of day to file pointer
-
- void gtodstr(char *);
- Get time of day to a string
-
- int daynum(int, int, int);
- Find the number of a date within a year
-
- int isleap(int);
- Check if year is a leap year
-
- int weekday(int, int, int);
- Determine the day of the week form the date
-
- char * monthis(int);
- Return a string pointer to name of month
-
- char * wkdayname(int);
- Returns name of the day of the week
-
-
- *=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
- * MFLSYS.H *
- *=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
-
-
- **********************************************************
- * Encryption/decryption *
- **********************************************************
-
- void crypt(char *);
- Encrypt/decrypt buffer data
-
- LOGICAL cryptqual(char *, int);
- Qualify an encryption key
-
- **********************************************************
- * Serial communications functions *
- **********************************************************
-
- void setport(int, int);
- Set port configuration
-
- void setdtr(int, int);
- Set state of data terminal ready flag
-
- void setrts(int, int);
- Set state of ready to send flag
-
- void writechar(int, int);
- Send a char to the serial port
-
- int readchar(int);
- Read a character from serial port
-
- int ready_recv(int);
- Check for character availability
-
- int ready_xmt(int);
- Check if port can accept a char to send
-
- int chkdsr(int);
- Check state of data set ready flag
-
- int chkdcd(int);
- Check state of carrier detect flag
-
- int chkcts(int);
- Check state of clear to send flag
-
- int chkring(int);
- Check state of ring indicator flag
-
- int config_port(unsigned, int, int, int, int);
-
- **********************************************************
- * Printer functions *
- **********************************************************
-
- void pr_putline(char *);
- Print a string, and a cr/lf to the printer
-
- void pr_puts(char *);
- Print a string to the printer
-
- void pr_set(int);
- Set the number of the current printer
-
- void pr_nl(void);
- Print a carriage return/line feed to printer
-
- void pr_eject(void);
- Send a formfeed to the printer
-
- void pr_carret(void);
- Send a carriage return to the printer
-
- int blpr(char, int);
- Write a character to LPT? through BIOS 17H
-
- int blprstat(int);
- Get LPT? status through BIOS 17H
-
- int pr_putc(char);
- Send a character to the printer
-
- **********************************************************
- * Gameport functions *
- **********************************************************
-
- void init_game(unsigned char);
- Initialize and set game port mode
-
- void clear_game(void);
- Clear pending input from game port
-
- void debounce(void);
- Input debouncer
-
- unsigned char get_press(void);
- Returns fully debounced key value
-
- **********************************************************
- * Error handling functions *
- **********************************************************
-
- void aabort(int);
- Terminate a program using a common exit
-
- void error(char *);
- Report a fatal error and exit
-
- int ctlbrk();
- Control-break (^C) interrupt handler
-
- **********************************************************
- * Miscellaneous system functions *
- **********************************************************
-
- void get_code_adr(unsigned int *, unsigned int *, unsigned int *);
- Get a function address
-
- void get_data_adr(unsigned int *, unsigned int *, unsigned int *);
- Get a data item address
-
- int _getdi(int);
- Get device information for file handle
-
- int ibmtype(void);
- Find out type of computer
-
- LOGICAL ansisys(void);
- Reports the availability of ANSI.SYS
-
-
- *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
- * MFLSTRNG.H *
- *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
-
-
- char LAST_CHAR(char *);
- Returns last string character
-
- char NEXT_TO_LAST_CHAR(char *);
- Returns penultimate string character
-
- char STRING_TERMINATOR(char *);
- Returns terminating '\0'
-
- LOGICAL STREQ(char *, char *);
- Compares strings TRUE/FALSE
-
- LOGICAL STREQI(char *, char *);
- Compares strings TRUE/FALSE, UC/LC
-
- int index(char *, char);
- Offset of leftmost char in a string
-
- int rindex(char *, char);
- Offset of rightmost char in a string
-
- **********************************************************
- * BASIC-like string functions *
- **********************************************************
-
- char * stralloc(int);
- Allocate a string from a string pool
-
- char * left(char *, int);
- Return leftmost characters
-
- char * right(char *, int);
- Return rightmost characters
-
- char * mid(char *, int, int);
- Return embedded substring
-
- char * string_add(char *, ...);
- BASIC-style string concatenation
-
- int str_init(int, int);
- Initialize a string pool
-
- void str_free(void);
- Free's the string pool
-
- **********************************************************
- * String translation functions *
- **********************************************************
-
- int strxlat(char *, char *, char *);
- Translates characters based on tables
-
- int strixlat(char *, char *, char *);
- Translates characters based on tables UC/LC
-
- int strnxlat(char *, char *, char *, int);
- Translates first N characters based on tables
-
- int strnixlat(char *, char *, char *, int);
- Translates first N characters based on tables UC/LC
-
- **********************************************************
- * Functions to remove unwanted characters *
- **********************************************************
-
- void strip(char *);
- Removes trailing newlines
-
- void lv1ws(char *);
- Converts all multiple whitespace to single spaces
-
- char * rmlead(char *);
- Removes leading whitespace
-
- char * rmtrail(char *);
- Removes trailing whitespace
-
- char * rmallws(char *);
- Removes all whitespace
-
- **********************************************************
- * Miscellaneous string functions *
- **********************************************************
-
- void fillch(char *, char, int);
- Fill a string with a character
-
- void loadstr(char *, char *, int);
- Load a string with padding
-
- int argval(char *, int *, int);
- Convert an ASCII numerical string from an argument
-
- int center(char *, int);
- Center a string
-
- int dstr_i(char *, int*);
- Make an ASCII decimal string into an integer
-
- int i_dstr(char *, int);
- Make an integer from a decimal ASCII string
-
- unsigned int hstr_i(char *);
- Make an ASCII hexadecimal string into an integer
-
-
- *=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
- * MFLMATH.H *
- *=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
-
-
- **********************************************************
- * CRC calculation functions *
- **********************************************************
-
- unsigned crc16_clear(void);
- Clear a 16-bit crc value
-
- unsigned crc16_update(unsigned, unsigned char);
- Update a 16-bit crc value
-
- unsigned crc16_finish(unsigned);
- Finish a 16-bit crc calculation
-
- unsigned long char crc32_clear(void);
- Clear a 32-bit crc value
-
- unsigned long crc32_update(unsigned long, unsigned char);
- Update a 32-bit crc value
-
- unsigned long crc32_finish(unsigned long);
- Finish a 32-bit crc calculation
-
- **********************************************************
- * Integer math functions *
- **********************************************************
-
- int isqrt(unsigned);
- Extract integer square root of an int
-
- int isqrtr(unsigned);
- Extract integer square root of an int w/ rounding
-
- long lsqrt(unsigned long);
- Extract integer square root of a long
-
- long lsqrtr(unsigned long);
- Extract integer square root of a long w/ rounding
-
-
- *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
- * MFLDEFS.H *
- *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
-
-
- #define KB_flush()
- Empties keyboard buffer
-
- #define Bputc(c)
- Write a character using BIOS only
-
- #define BitSet(arg,posn)
- Set n'th bit
-
- #define BitClr(arg,posn)
- Clear n'th bit
-
- #define BitTst(arg,posn)
- Test n'th bit
-
-
- *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
- * MFLSOUND.H *
- *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
-
-
- void mktone(int, int, int);
- Make a tone to the speaker (with music capability)
-
- void soundon(void);
- Turn on the speaker
-
- void soundoff(void);
- Turn off the speaker
-
-