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