Blame win/win.h

Packit 022b05
/*
Packit 022b05
 * win.h --
Packit 022b05
 *
Packit 022b05
 *      Some helper functions to make libsmi compile with vc++ for win32.
Packit 022b05
 *
Packit 022b05
 * Copyright (c) 2000 E. Schoenfelder, Gaertner Datensysteme Braunschweig.
Packit 022b05
 * Copyright (c) 2000 J. Schoenwaelder, Technical University of Braunschweig.
Packit 022b05
 *
Packit 022b05
 * See the file "COPYING" for information on usage and redistribution
Packit 022b05
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Packit 022b05
 *
Packit 022b05
 * @(#) $Id: win.h 8057 2008-04-15 14:31:18Z schoenw $
Packit 022b05
 */
Packit 022b05
Packit 022b05
#ifndef _WIN_H
Packit 022b05
#define _WIN_H
Packit 022b05
Packit 022b05
#include <ctype.h>
Packit 022b05
#include <limits.h>
Packit 022b05
#include <io.h>
Packit 022b05
Packit 022b05
/*
Packit 022b05
 * The access() function exists in the Win32 API, but there are no
Packit 022b05
 * defines for the mode parameter. So we provided them here.
Packit 022b05
 */
Packit 022b05
Packit 022b05
#ifndef F_OK
Packit 022b05
#define F_OK	00
Packit 022b05
#endif
Packit 022b05
#ifndef W_OK
Packit 022b05
#define W_OK	02
Packit 022b05
#endif
Packit 022b05
#ifndef R_OK
Packit 022b05
#define R_OK	04
Packit 022b05
#endif
Packit 022b05
Packit 022b05
/*
Packit 022b05
 * Other function prototypes...
Packit 022b05
 */
Packit 022b05
Packit 022b05
#if ! defined(__GNUC__) && defined(__STDC__)
Packit 022b05
int __cdecl fileno(FILE *); 
Packit 022b05
#endif
Packit 022b05
Packit 022b05
/*
Packit 022b05
 * isascii() is a non __STDC__ extension needed when __STDC__ is defined in
Packit 022b05
 * Win32 environment.
Packit 022b05
 */
Packit 022b05
Packit 022b05
#if defined(__STDC__)
Packit 022b05
#ifndef isascii
Packit 022b05
#define isascii(_c)   ( (unsigned)(_c) < 0x80 )
Packit 022b05
#endif
Packit 022b05
#endif
Packit 022b05
Packit 022b05
/*
Packit 022b05
 * Windows seems to lacks C99 function fabsf(), strtold(). Well, this
Packit 022b05
 * is only true for some compilers on Windows - gcc is fine since it
Packit 022b05
 * comes with a C99 library.
Packit 022b05
 */
Packit 022b05
Packit 022b05
#if ! defined(__GNUC__)
Packit 022b05
#define fabsf		fabs
Packit 022b05
#define strtold		strtod
Packit 022b05
#endif
Packit 022b05
Packit 022b05
/*
Packit 022b05
 * Some Windows compilers seem to lack strtof() so we fake it here.
Packit 022b05
 */
Packit 022b05
Packit 022b05
#if defined(_MSC_VER)
Packit 022b05
#define strtof(f1,f2) ((float)strtod(f1,f2))
Packit 022b05
Packit 022b05
/*
Packit 022b05
 * Windows compiler writers love to issue warnings for C functions
Packit 022b05
 * whose names were changed by C++ standards.  Since access is used as
Packit 022b05
 * the name of a structure member it has to be treated differently.
Packit 022b05
 */
Packit 022b05
Packit 022b05
#define access(f1,f2) _access(f1,f2)
Packit 022b05
#define putenv        _putenv
Packit 022b05
#define strdup        _strdup
Packit 022b05
#define vsnprintf     _vsnprintf
Packit 022b05
#define strcasecmp    _stricmp
Packit 022b05
Packit 022b05
#endif /* _MSC_VER */
Packit 022b05
Packit 022b05
#endif /* _WIN_H */