Showing posts with label Definitions. Show all posts
Showing posts with label Definitions. Show all posts

string.h Definitions for memory and string functions

/* string.h

Definitions for memory and string functions.

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

#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned size_t;
#endif

void *_Cdecl memccpy (void *dest, const void *src, int c, size_t n);
void *_Cdecl memchr (const void *s, int c, size_t n);
int _Cdecl memcmp (const void *s1, const void *s2, size_t n);
void *_Cdecl memcpy (void *dest, const void *src, size_t n);
int _Cdecl memicmp (const void *s1, const void *s2, size_t n);
void *_Cdecl memmove (void *dest, const void *src, size_t n);
void *_Cdecl memset (void *s, int c, size_t n);
void _Cdecl movedata(unsigned srcseg, unsigned srcoff, unsigned dstseg,
unsigned dstoff, size_t n);
char *_Cdecl stpcpy (char *dest, const char *src);
char *_Cdecl strcat (char *dest, const char *src);
char *_Cdecl strchr (const char *s, int c);
int _Cdecl strcmp (const char *s1, const char *s2);
char *_Cdecl strcpy (char *dest, const char *src);
size_t _Cdecl strcspn (const char *s1, const char *s2);
char *_Cdecl strdup (const char *s);
char *_Cdecl strerror(int errnum);
int _Cdecl stricmp (const char *s1, const char *s2);
size_t _Cdecl strlen (const char *s);
char *_Cdecl strlwr (char *s);
char *_Cdecl strncat (char *dest, const char *src, size_t maxlen);
int _Cdecl strncmp (const char *s1, const char *s2, size_t maxlen);
char *_Cdecl strncpy (char *dest, const char *src, size_t maxlen);
int _Cdecl strnicmp(const char *s1, const char *s2, size_t maxlen);
char *_Cdecl strnset (char *s, int ch, size_t n);
char *_Cdecl strpbrk (const char *s1, const char *s2);
char *_Cdecl strrchr (const char *s, int c);
char *_Cdecl strrev (char *s);
char *_Cdecl strset (char *s, int ch);
size_t _Cdecl strspn (const char *s1, const char *s2);
char *_Cdecl strstr (const char *s1, const char *s2);
char *_Cdecl strtok (char *s1, const char *s2);
char *_Cdecl strupr (char *s);

/* compatibility with other compilers */

#define strcmpi(s1,s2) stricmp(s1,s2)
#define strncmpi(s1,s2,n) strnicmp(s1,s2,n)

#if !__STDC__
char *_Cdecl _strerror (const char *s);
#endif


stdlib.h Definitions for common types, variables, and functions

/*      stdlib.h

        Definitions for common types, variables, and functions.

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

#if     !defined(__STDLIB)
#define __STDLIB

#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned size_t;
#endif

#ifndef _DIV_T
#define _DIV_T
typedef struct {
        int     quot;
        int     rem;
} div_t;
#endif

#ifndef _LDIV_T
#define _LDIV_T
typedef struct {
        long    quot;
        long    rem;
} ldiv_t;
#endif

#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1

/* Maximum value returned by "rand" function
*/
#define RAND_MAX 0x7FFF

typedef void _Cdecl (* atexit_t)(void);

void    _Cdecl abort  (void);
int     _Cdecl abs    (int x);
int     _Cdecl atexit (atexit_t func);
double  _Cdecl atof   (const char *s);
int     _Cdecl atoi   (const char *s);
long    _Cdecl atol   (const char *s);
void   *_Cdecl bsearch(const void *key, const void *base,
                       size_t nelem, size_t width,
                       int _Cdecl (*fcmp)(/* const void *, const void * */));
void   *_Cdecl calloc (size_t nitems, size_t size);
div_t   _Cdecl div    (int numer, int denom);
void    _Cdecl exit   (int status);
void    _Cdecl free   (void *block);
char   *_Cdecl getenv (const char *name);
long    _Cdecl labs   (long x);
ldiv_t  _Cdecl ldiv   (long numer, long denom);
void   *_Cdecl malloc (size_t size);
void    _Cdecl qsort  (void *base, size_t nelem, size_t width,
                       int _Cdecl (*fcmp)(/* const void *, const void * */));
int     _Cdecl rand   (void);
void   *_Cdecl realloc(void *block, size_t size);
void    _Cdecl srand  (unsigned seed);
double  _Cdecl strtod (const char *s, char **endptr);
long    _Cdecl strtol (const char *s, char **endptr, int radix);
unsigned long _Cdecl strtoul (const char *s, char **endptr, int radix);
int     _Cdecl system (const char *command);

#if !__STDC__

#ifndef NULL
#if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
#define NULL    0
#else
#define NULL    0L
#endif
#endif

/* Variables */
extern  int             _Cdecl _doserrno;
extern  char          **_Cdecl environ;
extern  int             _Cdecl errno;
extern  int             _Cdecl _fmode;
extern  unsigned char   _Cdecl _osmajor;
extern  unsigned char   _Cdecl _osminor;
extern  unsigned        _Cdecl _psp;
extern  char           *_Cdecl sys_errlist[];
extern  int             _Cdecl sys_nerr;
extern  unsigned int    _Cdecl _version;

int     _Cdecl __abs__(int x);          /* This is an in-line function */
#define abs(x)          __abs__(x)
#define atoi(s)         ((int) atol (s))

#define max(a,b)        (((a) > (b)) ? (a) : (b))
#define min(a,b)        (((a) < (b)) ? (a) : (b))

#define random(num)     (rand() % (num))
#define randomize()     srand((unsigned)time(NULL))

char   *_Cdecl ecvt     (double value, int ndig, int *dec, int *sign);
void    _Cdecl _exit    (int status);
char   *_Cdecl fcvt     (double value, int ndig, int *dec, int *sign);
char   *_Cdecl gcvt     (double value, int ndec, char *buf);
char   *_Cdecl itoa     (int value, char *string, int radix);
void   *_Cdecl lfind    (const void *key, const void *base,
                         size_t *num, size_t width,
                         int _Cdecl (*fcmp)(/* const void *, const void * */));

unsigned long _Cdecl _lrotl(unsigned long val, int count);
unsigned long _Cdecl _lrotr(unsigned long val, int count);

void   *_Cdecl lsearch  (const void *key, void *base,
                         size_t *num, size_t width,
                         int _Cdecl (*fcmp)(/* const void *, const void * */));
char   *_Cdecl ltoa     (long value, char *string, int radix);
int     _Cdecl putenv   (const char *name);

unsigned _Cdecl _rotl   (unsigned value, int count);
unsigned _Cdecl _rotr   (unsigned value, int count);

void    _Cdecl swab     (char *from, char *to, int nbytes);
char   *_Cdecl ultoa    (unsigned long value, char *string, int radix);
#endif

#endif


stdio.h Definitions for stream input/output

/*      stdio.h

        Definitions for stream input/output.

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

#if     !defined(__STDIO_DEF_)
#define __STDIO_DEF_

#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned size_t;
#endif
#ifndef NULL
#   if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
#   define      NULL    0
#   else
#   define      NULL    0L
#   endif
#endif

#if     !defined(__STDARG)
#include        <stdarg.h>
#endif

/* Definition of the file position type
*/
typedef long    fpos_t;

/* Definition of the control structure for streams
*/
typedef struct  {
        short           level;          /* fill/empty level of buffer */
        unsigned        flags;          /* File status flags    */
        char            fd;             /* File descriptor      */
        unsigned char   hold;           /* Ungetc char if no buffer */
        short           bsize;          /* Buffer size          */
        unsigned char   *buffer;        /* Data transfer buffer */
        unsigned char   *curp;          /* Current active pointer */
        unsigned        istemp;         /* Temporary file indicator */
        short           token;          /* Used for validity checking */
}       FILE;                           /* This is the FILE object */

/* Bufferisation type to be used as 3rd argument for "setvbuf" function
*/
#define _IOFBF  0
#define _IOLBF  1
#define _IONBF  2

/*      "flags" bits definitions
*/
#define _F_RDWR 0x0003                  /* Read/write flag      */
#define _F_READ 0x0001                  /* Read only file       */
#define _F_WRIT 0x0002                  /* Write only file      */
#define _F_BUF  0x0004                  /* Malloc'ed Buffer data */
#define _F_LBUF 0x0008                  /* line-buffered file   */
#define _F_ERR  0x0010                  /* Error indicator      */
#define _F_EOF  0x0020                  /* EOF indicator        */
#define _F_BIN  0x0040                  /* Binary file indicator */
#define _F_IN   0x0080                  /* Data is incoming     */
#define _F_OUT  0x0100                  /* Data is outgoing     */
#define _F_TERM 0x0200                  /* File is a terminal   */

/* End-of-file constant definition
*/
#define EOF     (-1)                    /* End of file indicator */

/* Number of files that can be open simultaneously
*/
#define OPEN_MAX 20                     /* Total of 20 open files */
#define SYS_OPEN 20

/* Default buffer size use by "setbuf" function
*/
#define BUFSIZ  512                     /* Buffer size for stdio */

/* Size of an arry large enough to hold a temporary file name string
*/
#define L_ctermid       5               /* CON: plus null byte */
#define L_tmpnam        13              /* tmpnam buffer size */

/* Constants to be used as 3rd argument for "fseek" function
*/
#define SEEK_CUR        1
#define SEEK_END        2
#define SEEK_SET        0

/* Number of unique file names that shall be generated by "tmpnam" function
*/
#define TMP_MAX         0xFFFF

/* Standard I/O predefined streams
*/
extern  FILE    _Cdecl _streams[];

#define stdin   (&_streams[0])
#define stdout  (&_streams[1])
#define stderr  (&_streams[2])
#define stdaux  (&_streams[3])
#define stdprn  (&_streams[4])

void     _Cdecl clearerr (FILE *stream);
int      _Cdecl fclose   (FILE *stream);
int      _Cdecl fflush   (FILE *stream);
int      _Cdecl fgetc    (FILE *stream);
int      _Cdecl fgetpos  (FILE *stream, fpos_t *pos);
char    *_Cdecl fgets    (char *s, int n, FILE *stream);
FILE    *_Cdecl fopen    (const char *path, const char *mode);
int      _Cdecl fprintf  (FILE *stream, const char *format, ...);
int      _Cdecl fputc    (int c, FILE *stream);
int      _Cdecl fputs    (const char *s, FILE *stream);
size_t   _Cdecl fread    (void *ptr, size_t size, size_t n, FILE *stream);
FILE    *_Cdecl freopen  (const char *path, const char *mode,
                          FILE *stream);
int      _Cdecl fscanf   (FILE *stream, const char *format, ...);
int      _Cdecl fseek    (FILE *stream, long offset, int whence);
int      _Cdecl fsetpos  (FILE *stream, const fpos_t *pos);
long     _Cdecl ftell    (FILE *stream);
size_t   _Cdecl fwrite   (const void *ptr, size_t size, size_t n,
                          FILE *stream);
char    *_Cdecl gets     (char *s);
void     _Cdecl perror   (const char *s);
int      _Cdecl printf   (const char *format, ...);
int      _Cdecl puts     (const char *s);
int      _Cdecl rename   (const char *oldname, const char *newname);
void     _Cdecl rewind   (FILE *stream);
int      _Cdecl scanf    (const char *format, ...);
void     _Cdecl setbuf   (FILE *stream, char *buf);
int      _Cdecl setvbuf  (FILE *stream, char *buf, int type, size_t size);
int      _Cdecl sprintf  (char *buffer, const char *format, ...);
int      _Cdecl sscanf   (const char *buffer, const char *format, ...);
char    *_Cdecl strerror (int errnum);
FILE    *_Cdecl tmpfile  (void);
char    *_Cdecl tmpnam   (char *s);
int      _Cdecl ungetc   (int c, FILE *stream);
int      _Cdecl vfprintf (FILE *stream, const char *format, va_list arglist);
int      _Cdecl vfscanf  (FILE *stream, const char *format, va_list arglist);
int      _Cdecl vprintf  (const char *format, va_list arglist);
int      _Cdecl vscanf   (const char *format, va_list arglist);
int      _Cdecl vsprintf (char *buffer, const char *format, va_list arglist);
int      _Cdecl vsscanf  (const char *buffer, const char *format, va_list arglist);

#if !__STDC__
int      _Cdecl fcloseall(void);
FILE    *_Cdecl fdopen   (int handle, char *type);
int      _Cdecl fgetchar (void);
int      _Cdecl flushall (void);
int      _Cdecl fputchar (int c);
int      _Cdecl getw     (FILE *stream);
int      _Cdecl putw     (int w, FILE *stream);
char    *_Cdecl _strerror(const char *s);
int      _Cdecl unlink   (const char *path);

#endif

int      _Cdecl _fgetc   (FILE *stream);             /* used by getc() macro */
int      _Cdecl _fputc   (char c, FILE *stream);     /* used by putc() macro */

/*      The following macros provide for common functions */

#define ferror(f)       ((f)->flags & _F_ERR)
#define feof(f)         ((f)->flags & _F_EOF)
#define fileno(f)       ((f)->fd)
#define remove(path)    unlink(path)

#define getc(f) \
  ((--((f)->level) >= 0) ? (unsigned char)(++(f)->curp)[-1] : \
_fgetc (f))
#define putc(c,f) \
  ((++((f)->level) < 0) ? (unsigned char)((++(f)->curp)[-1]=(c)) : \
_fputc ((c),f))

#define getchar()  getc(stdin)
#define putchar(c) putc((c), stdout)

#define ungetc(c,f)     ungetc((c),f)   /* traditionally a macro */

#endif



stddef.h Definitions for common types, NULL, and errno

/* stddef.h

Definitions for common types, NULL, and errno.

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

#ifndef _STDDEF
#define _STDDEF
#ifndef _PTRDIFF_T
#define _PTRDIFF_T
#if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
typedef long ptrdiff_t;
#else
typedef int ptrdiff_t;
#endif
#endif
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned size_t;
#endif

#ifndef NULL
#if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
#define NULL 0
#else
#define NULL 0L
#endif
#endif

extern int _Cdecl errno;

#endif


stdarg.h Definitions for accessing parameters in functions that accept a variable number of arguments

/* stdarg.h

Definitions for accessing parameters in functions that accept
a variable number of arguments.

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

#if !defined(__STDARG)
#define __STDARG

typedef void *va_list;

#define va_start(ap, parmN) (ap = ...)
#define va_arg(ap, type) (*((type *)(ap))++)
#define va_end(ap)
#define _va_ptr (...)
#endif


stat.h Definitions used for file status functions

/* stat.h

Definitions used for file status functions

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

#ifndef _STAT_H
#define _STAT_H 1

#define S_IFMT 0xF000 /* file type mask */
#define S_IFDIR 0x4000 /* directory */
#define S_IFIFO 0x1000 /* FIFO special */
#define S_IFCHR 0x2000 /* character special */
#define S_IFBLK 0x3000 /* block special */
#define S_IFREG 0x8000 /* or just 0x0000, regular */
#define S_IREAD 0x0100 /* owner may read */
#define S_IWRITE 0x0080 /* owner may write */
#define S_IEXEC 0x0040 /* owner may execute <directory search> */

struct stat
{
short st_dev;
short st_ino;
short st_mode;
short st_nlink;
int   st_uid;
int   st_gid;
short st_rdev;
long  st_size;
long  st_atime;
long  st_mtime;
long  st_ctime;
};

int  _Cdecl fstat (int handle, struct stat *statbuf);
int  _Cdecl stat  (char *path, struct stat *statbuf);

#endif /* _STAT_H */


math.h Definitions for the math floating point package.

/* math.h

Definitions for the math floating point package.

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

#ifndef  _MATH_H
#define  _MATH_H 1

#define EDOM 33 /* Math argument */
#define ERANGE 34 /* Result too large */

#define HUGE_VAL _huge_dble
extern double _Cdecl _huge_dble;

int _Cdecl abs   (int x);
double _Cdecl acos  (double x);
double _Cdecl asin  (double x);
double _Cdecl atan  (double x);
double _Cdecl atan2 (double y, double x);
double _Cdecl atof  (const char *s);
double _Cdecl ceil  (double x);
double _Cdecl cos   (double x);
double _Cdecl cosh  (double x);
double _Cdecl exp   (double x);
double _Cdecl fabs  (double x);
double _Cdecl floor (double x);
double _Cdecl fmod  (double x, double y);
double _Cdecl frexp (double x, int *exponent);
long _Cdecl labs  (long x);
double _Cdecl ldexp (double x, int exponent);
double _Cdecl log   (double x);
double _Cdecl log10 (double x);
double _Cdecl modf  (double x, double *ipart);
double _Cdecl pow   (double x, double y);
double _Cdecl sin   (double x);
double _Cdecl sinh  (double x);
double _Cdecl sqrt  (double x);
double _Cdecl tan   (double x);
double _Cdecl tanh  (double x);

struct exception
{
int type;
char   *name;
double arg1, arg2, retval;
};

int _Cdecl matherr (struct exception *e);

#if !__STDC__
double cdecl hypot (double x, double y);
double cdecl poly  (double x, int degree, double coeffs []);
double cdecl pow10 (int p);

struct complex    /* as used by "cabs" function */
{
    double  x, y;
};

#define cabs(z)     (hypot ((z).x, (z).y))

/*  The customary matherr() exception handler for maths functions is
    not compatible with the x3j11 draft standard for C.  _matherr() is
    provided as a compromise.
*/

typedef enum
{
    DOMAIN = 1,    /* argument domain error -- log (-1)        */
    SING,   /* argument singularity  -- pow (0,-2))     */
    OVERFLOW,   /* overflow range error  -- exp (1000)      */
    UNDERFLOW,   /* underflow range error -- exp (-1000)     */
    TLOSS,   /* total loss of significance -- sin(10e70) */
    PLOSS,   /* partial loss of signif. -- not used      */
}   _mexcep;

double _Cdecl _matherr (_mexcep why, char *fun, double  *arg1p,
double  *arg2p, double  retval);

/* Constants rounded for 21 decimals. */
#define M_E 2.71828182845904523536
#define M_LOG2E 1.44269504088896340736
#define M_LOG10E 0.434294481903251827651
#define M_LN2 0.693147180559945309417
#define M_LN10 2.30258509299404568402
#define M_PI 3.14159265358979323846
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.785398163397448309116
#define M_1_PI 0.318309886183790671538
#define M_2_PI 0.636619772367581343076
#define M_1_SQRTPI 0.564189583547756286948
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT2 1.41421356237309504880
#define M_SQRT_2 0.707106781186547524401

#endif /* __STDC__ */

#endif