SPTK Home Page
sptk5
sptk.h
1
/*
2
╔══════════════════════════════════════════════════════════════════════════════╗
3
║ SIMPLY POWERFUL TOOLKIT (SPTK) ║
4
╟──────────────────────────────────────────────────────────────────────────────╢
5
║ copyright © 1999-2022 Alexey Parshin. All rights reserved. ║
6
║ email alexeyp@gmail.com ║
7
╚══════════════════════════════════════════════════════════════════════════════╝
8
┌──────────────────────────────────────────────────────────────────────────────┐
9
│ This library is free software; you can redistribute it and/or modify it │
10
│ under the terms of the GNU Library General Public License as published by │
11
│ the Free Software Foundation; either version 2 of the License, or (at your │
12
│ option) any later version. │
13
│ │
14
│ This library is distributed in the hope that it will be useful, but │
15
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
16
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library │
17
│ General Public License for more details. │
18
│ │
19
│ You should have received a copy of the GNU Library General Public License │
20
│ along with this library; if not, write to the Free Software Foundation, │
21
│ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. │
22
│ │
23
│ Please report all bugs and problems to alexeyp@gmail.com. │
24
└──────────────────────────────────────────────────────────────────────────────┘
25
*/
26
27
#pragma once
28
29
#if defined(__GNUC__) || defined(__SUNPRO_CC)
33
#define __UNIX_COMPILER__
34
35
#endif
36
37
#ifndef __UNIX_COMPILER__
38
#if defined(SP_DLL) && defined(WIN32)
39
#ifdef SP_LIBRARY
40
#define SP_EXPORT __declspec(dllexport)
41
#else
42
#define SP_EXPORT __declspec(dllimport)
43
#endif
44
#else
45
#define SP_EXPORT
46
#endif
47
#else
48
#define SP_EXPORT
49
#endif
50
51
#ifndef __UNIX_COMPILER__
52
#if defined(WIN32)
53
#ifdef SP_DRIVER_LIBRARY
54
#define SP_DRIVER_EXPORT __declspec(dllexport)
55
#else
56
#define SP_DRIVER_EXPORT __declspec(dllimport)
57
#endif
58
#else
59
#define SP_DRIVER_EXPORT
60
#endif
61
#else
62
#define SP_DRIVER_EXPORT
63
#endif
64
65
#include <sptk5/sptk-config.h>
66
67
#if defined(_MSC_VER) || defined(__BORLANDC__)
68
#include <winsock2.h>
69
70
#include <process.h>
71
#include <windows.h>
72
#pragma warning(disable : 4251)
73
#pragma warning(disable : 4290)
74
#pragma warning(disable : 4355)
75
#pragma warning(disable : 4786)
76
#pragma warning(disable : 4996)
77
#if defined(_MSC_VER)
78
#define STRING_NPOS -1
79
#endif
80
#else
81
82
#include <cerrno>
83
#include <unistd.h>
84
85
#endif
86
87
#ifndef STRING_NPOS
91
#define STRING_NPOS string::npos
92
93
#endif
94
95
#include <array>
96
#include <map>
97
#include <string>
98
#include <vector>
99
100
#ifdef __UNIX_COMPILER__
101
102
#include <cinttypes>
103
#include <cstdint>
104
105
#elif __BORLANDC__
106
#include <ctype.h>
107
#include <stdint.h>
108
109
#elif defined(_MSC_VER)
110
#if _MSC_VER >= 1800
111
// Visual Studio 2013 and up
112
#include <inttypes.h>
113
#include <stdint.h>
114
#else
115
// Visual Studio 2012 and before
116
#include <inttypes.h>
117
#include <stdint.h>
118
#endif
119
#else
120
#include <inttypes.h>
121
#include <stdint.h>
122
123
#endif
124
125
#ifdef _WIN32
126
#define snprintf _snprintf
127
#define vsnprintf _vsnprintf
128
#define strcasecmp _stricmp
129
#define strncasecmp _strnicmp
130
#define strtok_r strtok_s
131
#include <filesystem>
132
namespace
fs = std::filesystem;
133
#else
134
#if __cplusplus >= 201703L && __has_include(<filesystem>)
135
136
#include <filesystem>
137
138
namespace
fs = std::filesystem;
139
#else
140
#include <experimental/filesystem>
141
namespace
fs = std::experimental::filesystem;
142
#endif
143
#endif
144
145
[[maybe_unused]]
constexpr
int
ALIGN_LEFT = 1;
146
[[maybe_unused]]
constexpr
int
ALIGN_RIGHT = 2;
147
[[maybe_unused]]
constexpr
int
ALIGN_CENTER = 3;
Fri Oct 14 2022 09:58:32: SPTK 5.4.1