Showing posts with label Macros. Show all posts
Showing posts with label Macros. Show all posts

float.h Defines implementation specific macros for dealing with floating point.


Copyright (c) Borland International 1987,1988
All Rights Reserved.
*/
#if __STDC__
#define _Cdecl
#else
#define _Cdecl cdecl
#endif

#define FLT_RADIX 2
#define FLT_ROUNDS 1
#define FLT_GUARD 1
#define FLT_NORMALIZE 1

#define DBL_DIG 15
#define FLT_DIG 6
#define LDBL_DIG 19

#define DBL_MANT_DIG 53
#define FLT_MANT_DIG 24
#define LDBL_MANT_DIG 64

#define DBL_EPSILON 2.2204460492503131E-16
#define FLT_EPSILON 1.19209290E-07F
#define LDBL_EPSILON 1.084202172485504E-19

/* smallest positive IEEE normal numbers */
#define DBL_MIN 2.2250738585072014E-308
#define FLT_MIN 1.17549435E-38F
#define LDBL_MIN _tiny_ldble

#define DBL_MAX _huge_dble
#define FLT_MAX _huge_flt
#define LDBL_MAX _huge_ldble

#define DBL_MAX_EXP +1024
#define FLT_MAX_EXP +128
#define LDBL_MAX_EXP +16384

#define DBL_MAX_10_EXP +308
#define FLT_MAX_10_EXP +38
#define LDBL_MAX_10_EXP +4932

#define DBL_MIN_10_EXP -307
#define FLT_MIN_10_EXP -37
#define LDBL_MIN_10_EXP -4931

#define DBL_MIN_EXP -1021
#define FLT_MIN_EXP -125
#define LDBL_MIN_EXP -16381

extern float _Cdecl _huge_flt;
extern double _Cdecl _huge_dble;
extern long double _Cdecl _huge_ldble;
extern long double _Cdecl _tiny_ldble;

unsigned int _Cdecl _clear87(void);
unsigned int _Cdecl _control87(unsigned int new, unsigned int mask);
void     _Cdecl _fpreset(void);
unsigned int _Cdecl _status87(void);

/* 8087/80287 Status Word format   */

#define SW_INVALID 0x0001 /* Invalid operation */
#define SW_DENORMAL 0x0002 /* Denormalized operand */
#define SW_ZERODIVIDE 0x0004 /* Zero divide */
#define SW_OVERFLOW 0x0008 /* Overflow */
#define SW_UNDERFLOW 0x0010 /* Underflow */
#define SW_INEXACT 0x0020 /* Precision (Inexact result) */

/* 8087/80287 Control Word format */

#define MCW_EM 0x003f /* interrupt Exception Masks */
#define    EM_INVALID 0x0001 /*   invalid */
#define    EM_DENORMAL 0x0002 /*   denormal */
#define    EM_ZERODIVIDE 0x0004 /*   zero divide */
#define    EM_OVERFLOW 0x0008 /*   overflow */
#define    EM_UNDERFLOW 0x0010 /*   underflow */
#define    EM_INEXACT 0x0020 /*   inexact (precision) */

#define MCW_IC 0x1000 /* Infinity Control */
#define    IC_AFFINE 0x1000 /*   affine */
#define    IC_PROJECTIVE 0x0000 /*   projective */

#define MCW_RC 0x0c00 /* Rounding Control */
#define    RC_CHOP 0x0c00 /*   chop */
#define    RC_UP 0x0800 /*   up */
#define    RC_DOWN 0x0400 /*   down */
#define    RC_NEAR 0x0000 /*   near */

#define MCW_PC 0x0300 /* Precision Control */
#define    PC_24 0x0000 /*    24 bits */
#define    PC_53 0x0200 /*    53 bits */
#define    PC_64 0x0300 /*    64 bits */

/* 8087/80287 Initial Control Word */
/* use affine infinity, mask underflow and precision exceptions */

#define CW_DEFAULT (RC_NEAR+PC_64+IC_AFFINE+EM_UNDERFLOW+EM_INEXACT)

/*
SIGFPE signal error types (for integer & float exceptions).
*/
#define FPE_INTOVFLOW 126 /* 80x86 Interrupt on overflow */
#define FPE_INTDIV0 127 /* 80x86 Integer divide by zero */

#define FPE_INVALID 129 /* 80x87 invalid operation */
#define FPE_ZERODIVIDE 131 /* 80x87 divide by zero */
#define FPE_OVERFLOW 132 /* 80x87 arithmetic overflow */
#define FPE_UNDERFLOW 133 /* 80x87 arithmetic underflow */
#define FPE_INEXACT 134 /* 80x87 precision loss */
#define FPE_EXPLICITGEN 140 /* When SIGFPE is raise()'d */

/*
SIGSEGV signal error types.
*/
#define SEGV_BOUND 10 /* A BOUND violation (SIGSEGV) */
#define SEGV_EXPLICITGEN 11 /* When SIGSEGV is raise()'d */

/*
SIGILL signal error types.
*/
#define ILL_EXECUTION 20 /* Illegal operation exception */
#define ILL_EXPLICITGEN 21 /* When SIGILL is raise()'d */

dos.h Defines structs, unions, macros, and functions for dealing with MSDOS and the Intel iAPX86 microprocessor family.

Copyright (c) Borland International 1987,1988
All Rights Reserved.
*/
#if __STDC__
#define _Cdecl
#else
#define _Cdecl cdecl
#endif

#if     !defined(__DOS_DEF_)
#define __DOS_DEF_

/* Variables */
extern int _Cdecl _8087;
extern int _Cdecl _argc;
extern char      **_Cdecl _argv;
extern char      **_Cdecl  environ;
extern int _Cdecl _doserrno;
extern unsigned _Cdecl _heaplen;
extern unsigned char _Cdecl _osmajor;
extern unsigned char _Cdecl _osminor;
extern unsigned _Cdecl _psp;
extern unsigned _Cdecl _stklen;
extern unsigned _Cdecl _version;

#define FA_RDONLY 0x01 /* Read only attribute */
#define FA_HIDDEN 0x02 /* Hidden file */
#define FA_SYSTEM 0x04 /* System file */
#define FA_LABEL 0x08 /* Volume label */
#define FA_DIREC 0x10 /* Directory */
#define FA_ARCH 0x20 /* Archive */

#define NFDS 20 /* Maximum number of fds */

struct fcb {
char fcb_drive; /* 0 = default, 1 = A, 2 = B */
char fcb_name[8]; /* File name */
char fcb_ext[3]; /* File extension */
short fcb_curblk; /* Current block number */
short fcb_recsize; /* Logical record size in bytes */
long fcb_filsize; /* File size in bytes */
short fcb_date; /* Date file was last written */
char fcb_resv[10]; /* Reserved for DOS */
char fcb_currec; /* Current record in block */
long fcb_random; /* Random record number */
};

struct xfcb {
char xfcb_flag; /* Contains 0xff to indicate xfcb */
char xfcb_resv[5]; /* Reserved for DOS */
char xfcb_attr; /* Search attribute */
struct fcb xfcb_fcb; /* The standard fcb */
};

struct country {
int co_date;
char co_curr[5];
char co_thsep[2];
char co_desep[2];
char co_dtsep[2];
char co_tmsep[2];
char co_currstyle;
char co_digits;
char co_time;
long co_case;
char co_dasep[2];
char co_fill[10];
};

struct DOSERROR {
int exterror;
char class;
char action;
char locus;
};

struct dfree {
unsigned df_avail;
unsigned df_total;
unsigned df_bsec;
unsigned df_sclus;
};

struct fatinfo {
char fi_sclus;
char fi_fatid;
int fi_nclus;
int fi_bysec;
};

struct devhdr {
long dh_next; /* Next device pointer */
short dh_attr; /* Attributes */
unsigned short dh_strat; /* Driver strategy routine */
unsigned short dh_inter; /* Driver interrupt routine */
char dh_name[8]; /* Device name */
};

struct time {
unsigned char ti_min; /* Minutes */
unsigned char ti_hour; /* Hours */
unsigned char ti_hund; /* Hundredths of seconds */
unsigned char ti_sec; /* Seconds */
};

struct date {
int da_year; /* Year - 1980 */
char da_day; /* Day of the month */
char da_mon; /* Month (1 = Jan) */
};

struct WORDREGS {
unsigned int ax, bx, cx, dx, si, di, cflag, flags;
};

struct BYTEREGS {
unsigned char al, ah, bl, bh, cl, ch, dl, dh;
};

union REGS {
struct WORDREGS x;
struct BYTEREGS h;
};

struct SREGS {
unsigned int es;
unsigned int cs;
unsigned int ss;
unsigned int ds;
};

struct REGPACK {
unsigned r_ax, r_bx, r_cx, r_dx;
unsigned r_bp, r_si, r_di, r_ds, r_es, r_flags;
};

#define FP_OFF(fp) ((unsigned)(fp))
#define FP_SEG(fp) ((unsigned)((unsigned long)(fp) >> 16))


typedef struct {
char drive; /* do not change */
char pattern [13]; /*  these fields, */
char reserved [7]; /*   Microsoft reserved */
char attrib;
short time;
short date;
long size;
char nameZ [13]; /* result of the search, asciiz */
} dosSearchInfo; /* used with DOS functions 4E, 4F */


int _Cdecl absread (int drive, int nsects, int lsect, void *buffer);
int _Cdecl abswrite(int drive, int nsects, int lsect, void *buffer);
int _Cdecl allocmem(unsigned size, unsigned *segp);
int _Cdecl bdos (int dosfun, unsigned dosdx, unsigned dosal);
int _Cdecl bdosptr (int dosfun, void *argument, unsigned dosal);
struct country *_Cdecl country (int xcode, struct country *cp);
void _Cdecl ctrlbrk (int _Cdecl (*handler)(void));
void _Cdecl delay (unsigned milliseconds);
void _Cdecl disable (void);
int _Cdecl dosexterr (struct DOSERROR *eblkp);
long _Cdecl dostounix (struct date *d, struct time *t);
void          __emit__();
void _Cdecl enable (void);
int _Cdecl freemem (unsigned segx);
int _Cdecl getcbrk (void);
void _Cdecl getdate (struct date *datep);
void _Cdecl getdfree(unsigned char drive, struct dfree *dtable);
void _Cdecl getfat (unsigned char drive, struct fatinfo *dtable);
void _Cdecl getfatd (struct fatinfo *dtable);
unsigned _Cdecl getpsp (void);
int _Cdecl getswitchar (void);
void _Cdecl gettime (struct time *timep);
void interrupt (* _Cdecl getvect(int interruptno)) ();
int _Cdecl getverify (void);
void _Cdecl harderr (int _Cdecl (*handler)());
void _Cdecl hardresume (int axret);
void _Cdecl hardretn(int retn);
int _Cdecl inport (int portid);
unsigned char _Cdecl inportb(int portid);
int _Cdecl int86 (int intno, union REGS *inregs, union REGS *outregs);
int _Cdecl int86x (int intno, union REGS *inregs, union REGS *outregs,
struct SREGS *segregs);
int _Cdecl intdos (union REGS *inregs, union REGS *outregs);
int _Cdecl intdosx (union REGS *inregs, union REGS *outregs,
struct SREGS *segregs);
void _Cdecl intr (int intno, struct REGPACK *preg);
void _Cdecl keep (unsigned char status, unsigned size);
void _Cdecl nosound (void);
void _Cdecl outport (int portid, int value);
void _Cdecl outportb(int portid, unsigned char value);
char *_Cdecl parsfnm (const char *cmdline, struct fcb *fcb, int opt);
int _Cdecl peek (unsigned segment, unsigned offset);
char _Cdecl peekb (unsigned segment, unsigned offset);
void _Cdecl poke (unsigned segment, unsigned offset, int value);
void _Cdecl pokeb (unsigned segment, unsigned offset, char value);
int _Cdecl randbrd (struct fcb *fcb, int rcnt);
int _Cdecl randbwr (struct fcb *fcb, int rcnt);
void _Cdecl segread (struct SREGS *segp);
int _Cdecl setblock(unsigned segx, unsigned newsize);
int _Cdecl setcbrk (int cbrkvalue);
void _Cdecl setdate (struct date *datep);
void _Cdecl setswitchar (char ch);
void _Cdecl settime (struct time *timep);
void _Cdecl setvect (int interruptno, void interrupt (*isr) ());
void _Cdecl setverify (int value);
void _Cdecl sleep (unsigned seconds);
void _Cdecl sound (unsigned frequency);
void _Cdecl unixtodos (long time, struct date *d, struct time *t);
int _Cdecl unlink (const char *path);

/* These are in-line functions.  These prototypes just clean up
  some syntax checks and code generation.
*/

void _Cdecl __cli__ (void);
void _Cdecl __sti__ (void);
unsigned char _Cdecl __inportb__(int portid);
void _Cdecl __outportb__ (int portid, unsigned char value);
void _Cdecl __int__ (int interruptnum);

#define disable() __cli__() /* Clear interrupt flag */
#define enable() __sti__() /* Set interrupt flag */
#define inportb(portid) __inportb__(portid) /* Byte IN instruction */
#define outportb(portid, v) __outportb__(portid,v)/* Byte OUT instruction */
#define geninterrupt(i) __int__(i) /* Interrupt instruction */

/* some other compilers use inp, outp for inportb, outportb */
#define inp(portid) inportb(portid)
#define outp(portid,v) outportb(portid,v)

#if !__STDC__
char far *cdecl getdta(void);
void  cdecl setdta(char far *dta);

#define MK_FP(seg,ofs) ((void far *) \
  (((unsigned long)(seg) << 16) | (unsigned)(ofs)))

#define poke(a,b,c) (*((int  far*)MK_FP((a),(b))) = (int)(c))
#define pokeb(a,b,c) (*((char far*)MK_FP((a),(b))) = (char)(c))
#define peek(a,b) (*((int  far*)MK_FP((a),(b))))
#define peekb(a,b) (*((char far*)MK_FP((a),(b))))
#endif

#endif

dir.h Defines structures, macros, and functions for dealing with directories and pathnames.

Copyright (c) Borland International 1987,1988
All Rights Reserved.
*/
#if __STDC__
#define _Cdecl
#else
#define _Cdecl cdecl
#endif

#if     !defined(__DIR_DEF_)
#define __DIR_DEF_

struct ffblk {
char ff_reserved[21];
char ff_attrib;
unsigned ff_ftime;
unsigned ff_fdate;
long ff_fsize;
char ff_name[13];
};

#define WILDCARDS 0x01
#define EXTENSION 0x02
#define FILENAME  0x04
#define DIRECTORY 0x08
#define DRIVE  0x10

#define MAXPATH   80
#define MAXDRIVE  3
#define MAXDIR  66
#define MAXFILE   9
#define MAXEXT  5

int _Cdecl chdir (const char *path);
int _Cdecl findfirst (const char *path, struct ffblk *ffblk,
int attrib);
int _Cdecl findnext (struct ffblk *ffblk);
void _Cdecl fnmerge (char *path,const char *drive,const char *dir,
const char *name, const char *ext);
int _Cdecl fnsplit (const char *path, char *drive, char *dir,
char *name, char *ext);
int _Cdecl getcurdir (int drive, char *directory);
char *_Cdecl getcwd (char *buf, int buflen);
int _Cdecl getdisk (void);
int _Cdecl mkdir (const char *path);
char *_Cdecl mktemp (char *template);
int _Cdecl rmdir (const char *path);
char *_Cdecl searchpath (const char *file);
int _Cdecl setdisk (int drive);

#endif

ctype.h Defines the ctype macros.

Copyright (c) Borland International 1987,1988
All Rights Reserved.
*/
#if __STDC__
#define _Cdecl
#else
#define _Cdecl cdecl
#endif

#define _IS_SP 1 /* is space */
#define _IS_DIG 2 /* is digit indicator */
#define _IS_UPP 4 /* is upper case */
#define _IS_LOW 8 /* is lower case */
#define _IS_HEX 16 /* [A-F or [a-f] */
#define _IS_CTL 32 /* Control */
#define _IS_PUN 64 /* punctuation */

extern char _Cdecl _ctype[]; /* Character type array */

#define isalnum(c) (_ctype[(c) + 1] & (_IS_DIG | _IS_UPP | _IS_LOW))
#define isalpha(c) (_ctype[(c) + 1] & (_IS_UPP | _IS_LOW))
#define isascii(c) ((unsigned)(c) < 128)
#define iscntrl(c) (_ctype[(c) + 1] & _IS_CTL)
#define isdigit(c) (_ctype[(c) + 1] & _IS_DIG)
#define isgraph(c) ((c) >= 0x21 && (c) <= 0x7e)
#define islower(c) (_ctype[(c) + 1] & _IS_LOW)
#define isprint(c) ((c) >= 0x20 && (c) <= 0x7e)
#define ispunct(c) (_ctype[(c) + 1] & _IS_PUN)
#define isspace(c) (_ctype[(c) + 1] & _IS_SP)
#define isupper(c) (_ctype[(c) + 1] & _IS_UPP)
#define isxdigit(c) (_ctype[(c) + 1] & (_IS_DIG | _IS_HEX))

#define _toupper(c) ((c) + 'A' - 'a')
#define _tolower(c) ((c) + 'a' - 'A')
#define toascii(c) ((c) & 0x7f)

int _Cdecl tolower(int ch);
int _Cdecl toupper(int ch);