omw  0.1.1
defs.h
Go to the documentation of this file.
1 /*
2 author Oliver Blaser
3 date 30.09.2021
4 copyright MIT - Copyright (c) 2021 Oliver Blaser
5 */
6 
7 #ifndef IG_OMW_DEFS_H
8 #define IG_OMW_DEFS_H
9 
10 
11 #include <cstddef>
12 #include <cstdint>
13 
14 
15 // platform
16 #if (defined(_WIN32) && !defined(_WIN64))
17 #define OMW_PLAT_WIN32 (1)
19 #endif
20 #ifdef _WIN64
21 #define OMW_PLAT_WIN64 (1)
23 #endif
24 #ifdef __unix__
25 #define OMW_PLAT_UNIX (1)
27 #endif
28 #if (defined(OMW_PLAT_WIN32) || defined(OMW_PLAT_WIN64))
29 #define OMW_PLAT_WIN (1)
31 #endif
32 
33 // debugging
34 #ifdef _DEBUG
35 #define OMW_DEBUG (1)
36 #else
37 #undef OMW_DEBUG
38 #endif
39 
40 
41 
42 constexpr const char* OMWi_file_to_filename(const char* p)
43 {
44  const char* fn = p;
45  while (*p)
46  {
47 #if defined(OMW_PLAT_WIN)
48  if (*p++ == '\\') fn = p;
49 #else
50  if (*p++ == '/') fn = p;
51 #endif
52  }
53  return fn;
54 }
55 
59 #define OMW__FILENAME__ (OMWi_file_to_filename(__FILE__))
60 
61 
62 
63 
64 
65 #define OMW_SIZE_MAX ((size_t)-1)
66 
67 
68 
69 
70 
71 
72 //
73 // internal use
74 //
75 
76 #define OMWi_DISPSTR(x) (x)
77 
78 // check for invalid combinations
79 #if ((defined(OMW_PLAT_WIN32) || defined(OMW_PLAT_WIN64) || defined(OMW_PLAT_WIN)) && defined(OMW_PLAT_UNIX))
80 #error invalid platform
81 #endif
82 #if (!defined(_DEBUG) && OMW_DEBUG)
83 #error invalid debug configuration
84 #endif
85 
86 #endif // IG_OMW_DEFS_H