VTFLib
A C and C++ API that, with a few simple functions, can open and save .vtf and .vmt files.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
stdafx.h
Go to the documentation of this file.
1 /*
2  * VTFLib
3  * Copyright (C) 2005-2011 Neil Jedrzejewski & Ryan Gregg
4 
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later
9  * version.
10  */
11 
12 // ============================================================
13 // NOTE: This file is commented for compatibility with Doxygen.
14 // ============================================================
20 #ifndef VTFLIB_STDAFX_H
21 #define VTFLIB_STDAFX_H
22 
23 #include "config.h"
24 
25 #if defined(_WIN32) || defined(_WIN64)
26 # ifndef __WINDOWS__
27 # define __WINDOWS__
28 # endif
29 #endif
30 
31 #ifdef __WINDOWS__
32 # ifdef VTFLIB_EXPORTS
33 # define VTFLIB_API __declspec(dllexport)
34 # else
35 # define VTFLIB_API __declspec(dllimport)
36 # endif
37 #else
38 # define VTFLIB_API __attribute__((visibility("default")))
39 #endif
40 
41 #ifdef _MSC_VER
42 # define VTFLIB_ALIGN16 __declspec(align(16))
43 # define VTFLIB_PRINTF(FMT,ARGS)
44 #else
45 # define VTFLIB_ALIGN16 __attribute__((aligned(16)))
46 # define VTFLIB_PRINTF(FMT,ARGS) __attribute__((format(printf, FMT, ARGS)))
47 #endif
48 
49 // Custom data types
50 typedef unsigned char vlBool;
51 typedef char vlChar;
52 typedef unsigned char vlByte;
53 typedef signed short vlShort;
54 typedef unsigned short vlUShort;
55 typedef signed int vlInt;
56 typedef unsigned int vlUInt;
57 typedef signed long vlLong;
58 typedef unsigned long vlULong;
59 typedef float vlSingle;
60 typedef double vlDouble;
61 typedef void vlVoid;
62 
63 typedef vlSingle vlFloat;
64 
65 #define vlFalse 0
66 #define vlTrue 1
67 
68 #include <stdlib.h>
69 #include <stdio.h>
70 #include <assert.h>
71 #include <math.h>
72 #include <stdarg.h>
73 
74 #ifdef __WINDOWS__
75 typedef vlLong vlOffset;
76 typedef vlUInt vlSSize;
77 typedef vlUInt vlSize;
78 
79 
80 typedef unsigned __int8 vlUInt8;
81 typedef unsigned __int16 vlUInt16;
82 typedef unsigned __int32 vlUInt32;
83 typedef unsigned __int64 vlUInt64;
84 
85 # if _MSC_VER >= 1400
86 # define _CRT_SECURE_NO_WARNINGS
87 # define _CRT_NONSTDC_NO_DEPRECATE
88 # endif
89 
90 # define WIN32_LEAN_AND_MEAN
91 # include <windows.h>
92 
93 # define vlFile HANDLE
94 
95 # ifndef strcasecmp
96 # define strcasecmp stricmp
97 # endif
98 
99 #else
100 
101 #include <cstdint>
102 
103 typedef off_t vlOffset;
104 typedef off_t vlSSize;
105 typedef size_t vlSize;
106 
107 typedef int8_t vlUInt8;
108 typedef int16_t vlUInt16;
109 typedef int32_t vlUInt32;
110 typedef int64_t vlUInt64;
111 
112 typedef FILE* vlFile;
113 
114 #endif
115 
116 #if !defined(_MSC_VER) || _MSC_VER >= 1600 // Visual Studio 2010
117 # define STATIC_ASSERT(condition, message) static_assert(condition, message)
118 #else
119 # define STATIC_ASSERT(condition, message) typedef char __C_ASSERT__[(condition) ? 1 : -1]
120 #endif
121 
122 typedef enum tagVLSeekMode
123 {
124 #ifdef __WINDOWS__
125  SEEK_MODE_BEGIN = FILE_BEGIN,
126  SEEK_MODE_CURRENT = FILE_CURRENT,
127  SEEK_MODE_END = FILE_END
128 #else
129  SEEK_MODE_BEGIN = SEEK_SET,
130  SEEK_MODE_CURRENT = SEEK_CUR,
131  SEEK_MODE_END = SEEK_END
132 #endif
133 } VLSeekMode;
134 
135 #endif
signed long vlLong
Signed long number.
Definition: stdafx.h:57
unsigned char vlByte
Single unsigned byte.
Definition: stdafx.h:52
unsigned long vlULong
Unsigned long number.
Definition: stdafx.h:58
vlSingle vlFloat
Floating point number (same as vlSingled).
Definition: stdafx.h:63
char vlChar
Single signed character.
Definition: stdafx.h:51
double vlDouble
Double number.
Definition: stdafx.h:60
unsigned int vlUInt
Unsigned integer value.
Definition: stdafx.h:56
signed short vlShort
Signed short floating point value.
Definition: stdafx.h:53
void vlVoid
Void value.
Definition: stdafx.h:61
unsigned short vlUShort
Unsigned short floating point value.
Definition: stdafx.h:54
signed int vlInt
Signed integer value.
Definition: stdafx.h:55
unsigned char vlBool
Boolean value 0/1.
Definition: stdafx.h:50
float vlSingle
Floating point number.
Definition: stdafx.h:59