1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
/* $Id: stdafx.h 17979 2009-11-05 22:11:04Z rubidium $ */
/*
* catcodec is a tool to decode/encode the sample catalogue for OpenTTD.
* Copyright (C) 2009 Remko Bijker
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/** @file stdafx.h Definition of base types and functions in a cross-platform compatible way. */
#ifndef STDAFX_H
#define STDAFX_H
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <assert.h>
#include <errno.h>
#include <string>
#if defined(_MSC_VER)
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#define UNUSED
#define fileno _fileno
#pragma warning(disable: 4996) // 'strdup' was declared deprecated
#elif defined(__GNUC__)
#include <stdint.h>
#define UNUSED __attribute__((unused))
#else
#warning "Unknown compiler type, might not compile!"
#include <stdint.h>
#define UNUSED
#endif
#if defined(WIN32)
#include <io.h>
#define isatty _isatty
#define unlink _unlink
#endif
#define assert_compile(expr) extern const int __ct_assert__[1 - 2 * !(expr)] UNUSED
/* Check if the types have the bitsizes like we are using them */
assert_compile(sizeof(uint32_t) == 4);
assert_compile(sizeof(uint16_t) == 2);
assert_compile(sizeof(uint8_t) == 1);
#endif /* STDAFX_H */
|