-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTXLib.h
15699 lines (12525 loc) · 691 KB
/
TXLib.h
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//=================================================================================================================
// [These sections are for folding control in Code::Blocks] [$Date: 2020-08-13 00:46:05 +0400 $]
// [Best viewed with "Fold all on file open" option enabled] [Best screen/page width = 120 chars]
//
// [If RUSSIAN CHARS below are UNREADABLE, check this file codepage. It should be CP1251, NOT UTF-8 etc.]
//{ [Use RELOAD options in your IDE or editor (CLion / Visual Studio Code / ...), and do NOT use Convert.]
//=================================================================================================================
//!
//! @file TXLib.h
//! @brief Библиотека Тупого Художника (The Dumb Artist Library, TX Library, TXLib).
//!
//! $Version: 00173a, Revision: 168 $
//! $Copyright: (C) Ded (Ilya Dedinsky, http://txlib.ru) <[email protected]> $
//! $Date: 2020-08-13 00:46:05 +0400 $
//!
//! TX Library -- компактная библиотека двумерной графики для MS Windows на С++. Это небольшая "песочница"
//! для начинающих реализована с целью помочь им в изучении простейших принципов программирования.
//! Документация на русском языке. Философия TX Library -- облегчить первые шаги в программировании
//! и подтолкнуть к творчеству и самостоятельности.
//!
//! TX Library is a tiny 2D graphics library for MS Windows written in C++. This is a small sandbox for the
//! very beginners to help them to learn basic programming principles. The documentation is in Russian.
//!
//! <b>Официальный сайт библиотеки:</b> <a href=http://txlib.ru><b>txlib.ru.</b></a>
//!
//! См. также <a href=http://sourceforge.net/p/txlib>страницу проекта на SourceForge.</a>
//! <b>Короткая ссылка на онлайн-документацию:</b> <a href=http://gg.gg/TXLib><b>gg.gg/TXLib.</b></a>
//!
//! @par Установка библиотеки
//!
//! <b>Скачать библиотеку:</b> <a href=http://sourceforge.net/project/platformdownload.php?group_id=213688>
//! <b>на сайте sourceforge.net.</b></a> См. также раздел @ref TXLibSetup "Установка библиотеки".
//!
//! @note Библиотека TXLib состоит из единственного файла и не требует никаких настроек в среде
//! программирования, чтобы облегчить ее установку и работу для начинающих.
//!
//! @note Файл библиотеки большой и может компилироваться долго, поэтому обратите внимание на возможность
//! использования прекомпилированной версии в проектак с раздельной компиляцией. См. макрос @ref TX_COMPILED.
//! Также можно определить макрос @c WIN32_LEAN_AND_MEAN до включения @c TXLib.h в программу.
//!
//! -# <a href=https://sourceforge.net/projects/txlib/files/latest/download>Скачайте</a> программу установки,
//! загрузка по ссылке начнется автоматически. Ее имя имеет вид <tt>TXLib-v0173a.rar.exe.</tt> Цифры могут
//! отличаться (это номер версии), расширение @c .exe может не отображаться, в зависимости от настроек Windows.
//! -# Запустите скачанную программу установки. Программа установки -- это саморазархивирующийся
//! архив, она не требует особых прав для запуска.
//! -# На рабочем столе появится "Ярлык для TX". Откройте его и запустите систему помощи <tt>TXLib Help,</tt>
//! изучите ее. Простейший пример см. <http://storage.ded32.net.ru/Lib/TX/TXUpdate/Doc/HTML.ru/a00001.htm>
//! здесь.</a> Другие примеры см. <a href=http://storage.ded32.net.ru/Lib/TX/TXUpdate/Doc/HTML.ru/dirs.htm>
//! в папке Examples,</a> в папке Examples/Demo.
//!
//! - Если при установке происходят ошибки или запуск программы установки невозможен, откройте файл библиотеки
//! @c TXLib.h <a href=http://storage.ded32.net.ru/Lib/TX/TXUpdate/TXLib.h> отсюда</a>, сохраните (Ctrl+S)
//! его в свою рабочую папку, где вы сохраняете свои программы.
//! Пользуйтесь <a href=http://storage.ded32.net.ru/Lib/TX/TXUpdate/Doc/HTML.ru/index.htm> системой помощи онлайн.</a>
//!
//! -# Для полной обработки ошибок библиотеке требуются модули, которые желательно установить (скопировать) в папку
//! Windows. Устанавливать эти библиотеки не обязательно. Программы, использующие TXLib, запускаются и без них.
//!
//! -# Модули библиотеки Microsoft DBGHELP для доступа к отладочным символам Microsoft:
//!
//! - @c dbghelp32.dll или dbghe32.dll - для 32-разрядных программ (либо @c dbghelp.dll, 32-разрядная версия),
//! - @c dbghelp64.dll или dbghe64.dll - для 64-разрядных программ (либо @c dbghelp.dll, 64-разрядная версия),
//!
//! -# Модули библиотеки <a href=https://github.com/jrfonseca/drmingw/releases>DrMinGW</a> для доступа
//! к отладочным символам MinGW компилятора GCC @c g++:
//!
//! - @c mgwhelp32.dll или mgwhe32.dll - для 32-разрядных программ (либо @c mgwhelp.dll, 32-разрядная версия),
//! - @c mgwhelp64.dll или mgwhe64.dll - для 64-разрядных программ (либо @c mgwhelp.dll, 64-разрядная версия).
//!
//! Суффиксы @c 32 и @c 64 помогают отличить 32-разрядную и 64-разрядную версии DLL-файлов библиотек.
//! Например, @c dbghelp32.dll -- это просто переименованная 32-разрядная версия файла @c dbghelp.dll.
//!
//! <b>Cамораспаковывающийся архив с этими библиотеками можно скачать
//! <a href=http://storage.ded32.net.ru/Lib/TX/TXLib-SupportDLLs.rar.exe>здесь.</a></b>
//!
//! Для наиболее полной диагностики ошибок полностью отключайте оптимизацию при компиляции. Например,
//! для компилятора GCC @c g++ -- с помощью ключа командной строки @c -O0. Разные среды программирования
//! позволяют задать эти ключи по-разному, например, в CodeBlocks через Главное меню -- Settings --
//! Compiler -- (Global Compiler Settings) -- (Compiler Settings) -- Other Options.
//!
//! @note Кодовая страница в редакторе среды разработки должна быть установлена как Windows CP1251, проверьте
//! это. В разных средах разработки она устанавливается по-разному, например, в CodeBlocks через
//! Главное меню -- Settings -- Editor -- (General Settings) -- Other Settings -- Encoding. Иначе
//! русские буквы в сообщениях TXLib будут отображаться неправильно.
//!
//! @warning <b>Это альфа-версия. Для использования библиотеки требуется согласование с ее автором.</b> @nn
//! <a href=http://www.ded32.ru/index/0-6>Правила использования материалов библиотеки и сайта</a> см. на
//! <a href=http://txlib.ru>официальном сайте TXLib.</a>
//!
//! @par Баг-трекер на GitHub:
//! - <a href=https://github.com/ded32/TXLib/issues/new><b>Сообщить об ошибке</b></a>
//!
// $Copyright: (C) Ded (Ilya Dedinsky, http://txlib.ru) <[email protected]> $
//-----------------------------------------------------------------------------------------------------------------
//!
//! @defgroup Drawing Рисование
//! @defgroup Mouse Поддержка Мыши!
//! @defgroup Dialogs Диалоговые окна
//! @defgroup Misc Разное
//! @defgroup Technical Технические детали
//}
//=================================================================================================================
#if !defined (__TXLIB_H_INCLUDED) // <<<<<<<<< THE CODE IS HERE, UNFOLD IT <<<<<<<<<<<<<<<<<<<<<<<<<
#define __TXLIB_H_INCLUDED
//-----------------------------------------------------------------------------------------------------------------
//{ Version information and configuration
//-----------------------------------------------------------------------------------------------------------------
//{----------------------------------------------------------------------------------------------------------------
//! @ingroup Technical
//! @brief Текущая версия библиотеки.
//!
//! Версия библиотеки в целочисленном формате: старшее слово -- номер версии, младшее -- номер ревизии,
//! в двоично-десятичном формате. Например, @c 0x172a0050 -- версия @c 0.172a, ревизия @c 50.
//! @code
//! #define _TX_VERSION "TXLib [Ver: 1.73a, Rev: 164, Date: 2020-01-30 05:00:00 +0300]" //
//! #define _TX_AUTHOR "Copyright (C) Ded (Ilya Dedinsky, http://txlib.ru)" // ПРИМЕР
//! #define _TX_VER 0x173a0000 //
//! @endcode
//! Эти константы автоматически обновляются при изменении версии.
//!
//! @see txVersion()
//!
//! @usage @code
//! #if !(defined (_TX_VER) && (_TX_VER >= 0x172a0000))
//! #error Must use TXLib.h version >= 1.72 to compile this.
//! #endif
//! @endcode
//!
//! @hideinitializer
//}----------------------------------------------------------------------------------------------------------------
//! @{
#define _TX_VER _TX_v_FROM_CVS ($VersionInfo: , TXLib.h, 00173a, 168, 2020-08-13 00:46:05 +0400, "Ded (Ilya Dedinsky, http://txlib.ru) <[email protected]>", $)
#define _TX_VERSION _TX_V_FROM_CVS ($VersionInfo: , TXLib.h, 00173a, 168, 2020-08-13 00:46:05 +0400, "Ded (Ilya Dedinsky, http://txlib.ru) <[email protected]>", $)
#define _TX_AUTHOR _TX_A_FROM_CVS ($VersionInfo: , TXLib.h, 00173a, 168, 2020-08-13 00:46:05 +0400, "Ded (Ilya Dedinsky, http://txlib.ru) <[email protected]>", $)
//! @cond INTERNAL
#define _TX_v_FROM_CVS(_1,file,ver,rev,date,auth,_2) ((0x##ver##u << 16) | 0x##rev##u)
#define _TX_V_FROM_CVS(_1,file,ver,rev,date,auth,_2) "TXLib [Ver: " #ver ", Rev: " #rev ", Date: " #date "]"
#define _TX_A_FROM_CVS(_1,file,ver,rev,date,auth,_2) "Copyright (C) " auth
//! @endcond
//! @}
//{----------------------------------------------------------------------------------------------------------------
//! @ingroup Technical
//! @brief Имя модуля TXLib. Входит в диагностические сообщения.
//!
//! @note Можно переопределять до включения файла TXLib.h.
//!
//! @hideinitializer
//}----------------------------------------------------------------------------------------------------------------
#if !defined (_TX_MODULE)
#define _TX_MODULE "TXLib"
#endif
//{----------------------------------------------------------------------------------------------------------------
//! @ingroup Technical
//! @brief Имя и версия текущего компилятора
//! @hideinitializer
//}----------------------------------------------------------------------------------------------------------------
#if defined (__GNUC__)
#define _GCC_VER ( __GNUC__*100 + __GNUC_MINOR__*10 + __GNUC_PATCHLEVEL__ )
#define __TX_COMPILER__ "GNU g++ " TX_QUOTE (__GNUC__) "." \
TX_QUOTE (__GNUC_MINOR__) "." \
TX_QUOTE (__GNUC_PATCHLEVEL__) \
", std=" TX_QUOTE (__cplusplus)
#elif defined (__clang__) || defined (__clang_major__)
#define _CLANG_VER ( __clang_major__*100 + __clang_minor__*10 + __clang_patchlevel__ )
#define __TX_COMPILER__ "Clang " TX_QUOTE (__clang_major__) "." \
TX_QUOTE (__clang_minor__) "." \
TX_QUOTE (__clang_patchlevel__) \
", std=" TX_QUOTE (__cplusplus)
#elif defined (_MSC_VER)
#define __TX_COMPILER__ "MSVS " TX_QUOTE (_MSC_VER) \
", std=" TX_QUOTE (__cplusplus)
#elif defined (__INTEL_COMPILER)
#define __TX_COMPILER__ "Intel C++ " TX_QUOTE (__INTEL_COMPILER) \
", std=" TX_QUOTE (__cplusplus)
#else
#define __TX_COMPILER__ "Unknown C++, std=" TX_QUOTE (__cplusplus)
#endif
//! @cond INTERNAL
#define TX_QUOTE(sym) _TX_QUOTE (sym)
#define _TX_QUOTE(sym) #sym
#define TX_JOIN(sym1, sym2) _TX_JOIN (sym1, sym2)
#define _TX_JOIN(sym1, sym2) sym1 ## sym2
//! @endcond
#if (__cplusplus >= 201103L) || defined (_MSC_VER) && (_MSC_VER >= 1800) // MSVC 2013
#define _TX_CPP11 1
#endif
#if (__cplusplus >= 201103L) || defined (_MSC_VER) && (_MSC_VER >= 1900) // MSVC 2015
#define _TX_CPP11_MSVC15 1
#endif
//{----------------------------------------------------------------------------------------------------------------
//! @ingroup Technical
//! @brief Имя режима сборки
//! @hideinitializer
//}----------------------------------------------------------------------------------------------------------------
#if !defined (NDEBUG) && defined (_DEBUG)
#define _TX_BUILDMODE "DEBUG"
#elif !defined (NDEBUG) && !defined (_DEBUG)
#define _TX_BUILDMODE "Debug"
#elif defined (NDEBUG)
#define _TX_BUILDMODE "Release"
#endif
//{----------------------------------------------------------------------------------------------------------------
//! @ingroup Misc
//! @brief Макрос, раскрывающийся в имя файла и номер строки файла, где он встретился.
//! @hideinitializer
//}----------------------------------------------------------------------------------------------------------------
#define __TX_FILELINE__ __FILE__ " (" TX_QUOTE (__LINE__) ")"
//{----------------------------------------------------------------------------------------------------------------
//! @ingroup Misc
//! @brief Имя текущей функции
//!
//! @warning Если определение имени функции не поддерживается компилятором, то __TX_FUNCTION__ раскрывается в имя
//! исходного файла и номер строки.
//!
//! @hideinitializer
//}----------------------------------------------------------------------------------------------------------------
#if defined (__GNUC__) || defined (__clang__) || defined (__clang_major__)
#define __TX_FUNCTION__ __PRETTY_FUNCTION__
#elif defined (__FUNCSIG__)
#define __TX_FUNCTION__ __FUNCSIG__
#elif defined (__FUNCTION__)
#define __TX_FUNCTION__ __FUNCTION__
#elif defined (__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)
#define __TX_FUNCTION__ __FUNCTION__
#elif defined (__BORLANDC__) && (__BORLANDC__ >= 0x550)
#define __TX_FUNCTION__ __FUNC__
#elif defined (__cplusplus) && (__cplusplus >= 199711L)
#define __TX_FUNCTION__ __func__
#elif defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
#define __TX_FUNCTION__ __func__
#elif defined (__PYTHON__)
#error No Python. No. Using parseltongue languages can lead you to Slytherin.
#else
#define __TX_FUNCTION__ "(" __TX_FILELINE__ ")"
#endif
#if !defined (__func__) && defined (__FUNCTION__)
#define __func__ __FUNCTION__
#endif
//}
//-----------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------
//{ Compiler- and platform-specific
//! @name Адаптация к компиляторам и платформам
//-----------------------------------------------------------------------------------------------------------------
//! @{ @cond INTERNAL
#if !defined (__cplusplus)
#ifdef __GNUC__
#error
#error ---------------------------------------------------------------------------------------
#endif
#error TXLib.h: Must use C++ to compile TXLib.h. Now you are using C only.
#error
#error CHECK source file EXTENSION. Maybe it is ".C". It must be ".CPP".
#error If your file is named, for example, "Untitled.C", go to menu [File],
#error then [Save As] and rename it to "Untitled.CPP". Please do NOT use spaces.
#error ---------------------------------------------------------------------------------------
#error
#endif
//-----------------------------------------------------------------------------------------------------------------
#if !defined (WIN32) && !defined (__WIN32__) && !defined(_WIN32) && !defined(_WIN32_WINNT) && !defined (__CYGWIN__)
#ifdef __GNUC__
#error
#error ---------------------------------------------------------------------------------------
#endif
#error TXLib.h: Windows (MSVC/Win32 or GCC/MinGW or Cygwin) is the only supported OS, sorry.
#error
#error In Linux or MacOS, you should write your own TXLib and share it with your friends, or use wine.
#error ---------------------------------------------------------------------------------------
#error
#endif
//-----------------------------------------------------------------------------------------------------------------
#if defined (UNICODE) || defined (_UNICODE)
#ifdef __GNUC__
#warning TXLib.h: Disabling the UNICODE
#endif
#undef UNICODE // Burn Unicode, burn
#undef _UNICODE
#if defined (_WINDOWS_H) || defined (_INC_WINDOWS) || defined (_WINDOWS_) || defined (__WINDOWS__)
#ifdef __GNUC__
#error
#error ---------------------------------------------------------------------------------------
#endif
#error TXLib.h: Should include "TXLib.h" BEFORE or INSTEAD of <Windows.h> in UNICODE mode.
#error
#error REARRANGE your #include directives, or DISABLE the UNICODE mode by #undef UNICODE/_UNICODE.
#error ---------------------------------------------------------------------------------------
#error
#endif
#endif
//-----------------------------------------------------------------------------------------------------------------
#if defined (__STRICT_ANSI__) // Try to extend strict ANSI rules
#undef __STRICT_ANSI__
#define __STRICT_ANSI__UNDEFINED
#if defined (_STRING_H_) || defined (_INC_STRING) || defined (_STDIO_H_) || defined (_INC_STDIO)
#ifdef __GNUC__
#error
#error ---------------------------------------------------------------------------------------
#endif
#error TXLib.h: Should include "TXLib.h" BEFORE <string.h> or <stdio.h> in Strict ANSI mode.
#error
#error REARRANGE your #include directives, or DISABLE ANSI-compliancy by #undef __STRICT_ANSI__.
#error ---------------------------------------------------------------------------------------
#error
#endif
#endif
//-----------------------------------------------------------------------------------------------------------------
#if defined (__GNUC__)
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic warning "-Wall"
#pragma GCC diagnostic warning "-Weffc++"
#pragma GCC diagnostic warning "-Wextra"
#pragma GCC diagnostic warning "-Waggressive-loop-optimizations"
#pragma GCC diagnostic warning "-Walloc-zero"
#pragma GCC diagnostic warning "-Walloca"
#pragma GCC diagnostic warning "-Walloca-larger-than=8192"
#pragma GCC diagnostic warning "-Warray-bounds"
#pragma GCC diagnostic warning "-Wcast-align"
#pragma GCC diagnostic warning "-Wcast-qual"
#pragma GCC diagnostic warning "-Wchar-subscripts"
#pragma GCC diagnostic warning "-Wconditionally-supported"
#pragma GCC diagnostic warning "-Wconversion"
#pragma GCC diagnostic warning "-Wctor-dtor-privacy"
#pragma GCC diagnostic warning "-Wdangling-else"
#pragma GCC diagnostic warning "-Wduplicated-branches"
#pragma GCC diagnostic warning "-Wempty-body"
#pragma GCC diagnostic warning "-Wfloat-equal"
#pragma GCC diagnostic warning "-Wformat-nonliteral"
#pragma GCC diagnostic warning "-Wformat-overflow=2"
#pragma GCC diagnostic warning "-Wformat-security"
#pragma GCC diagnostic warning "-Wformat-signedness"
#pragma GCC diagnostic warning "-Wformat-truncation=2"
#pragma GCC diagnostic warning "-Wformat=2"
#pragma GCC diagnostic warning "-Wlarger-than=8192"
#pragma GCC diagnostic warning "-Wlogical-op"
#pragma GCC diagnostic warning "-Wmissing-declarations"
#pragma GCC diagnostic warning "-Wnarrowing"
#pragma GCC diagnostic warning "-Wnon-virtual-dtor"
#pragma GCC diagnostic warning "-Wnonnull"
#pragma GCC diagnostic warning "-Wopenmp-simd"
#pragma GCC diagnostic warning "-Woverloaded-virtual"
#pragma GCC diagnostic warning "-Wpacked"
#pragma GCC diagnostic warning "-Wpointer-arith"
#pragma GCC diagnostic warning "-Wredundant-decls"
#pragma GCC diagnostic warning "-Wrestrict"
#pragma GCC diagnostic warning "-Wshadow"
#pragma GCC diagnostic warning "-Wsign-promo"
#pragma GCC diagnostic warning "-Wstack-usage=8192"
#pragma GCC diagnostic warning "-Wstrict-aliasing"
#pragma GCC diagnostic warning "-Wstrict-null-sentinel"
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
#pragma GCC diagnostic warning "-Wstringop-overflow=4"
#pragma GCC diagnostic warning "-Wsuggest-attribute=noreturn"
#pragma GCC diagnostic warning "-Wsuggest-final-methods"
#pragma GCC diagnostic warning "-Wsuggest-final-types"
#pragma GCC diagnostic warning "-Wsuggest-override"
#pragma GCC diagnostic warning "-Wswitch-default"
#pragma GCC diagnostic warning "-Wswitch-enum"
#pragma GCC diagnostic warning "-Wsync-nand"
#pragma GCC diagnostic warning "-Wundef"
#pragma GCC diagnostic warning "-Wunused"
#pragma GCC diagnostic warning "-Wvarargs"
#pragma GCC diagnostic warning "-Wvariadic-macros"
#pragma GCC diagnostic warning "-Wvla-larger-than=8192"
#pragma GCC diagnostic error "-Wsizeof-array-argument"
#pragma GCC diagnostic ignored "-Winline"
#pragma GCC diagnostic ignored "-Wliteral-suffix"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic ignored "-Wnonnull-compare"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wunreachable-code"
#pragma GCC diagnostic ignored "-Wunused-const-variable"
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic warning "-Wpragmas"
//{ These warning settings for TXLib.h only and will be re-enabled at end of file:
#pragma GCC push_options
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Waddress"
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wclobbered"
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#pragma GCC diagnostic ignored "-Wlarger-than="
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#pragma GCC diagnostic ignored "-Wredundant-decls"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#pragma GCC diagnostic ignored "-Wunused-label" // Just for fun in _txCanvas_OnCmdAbout()
#pragma GCC diagnostic ignored "-Wunused-value"
#pragma GCC diagnostic ignored "-Wformat-zero-length"
#pragma GCC diagnostic ignored "-Wpacked-not-aligned"
#pragma GCC optimize "no-strict-aliasing"
#if (__cplusplus < 201402L)
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
#pragma GCC diagnostic warning "-Wpragmas"
#if defined (__CYGWIN__) && !defined (_TX_TESTING)
#pragma GCC system_header // This is not a fair play, but this is the only way to deal with Cygwin :(
#endif
//}
#define _tx_thread __thread
#define _tx_decltype(value) __decltype (value)
#ifndef MINGW_HAS_SECURE_API
#define MINGW_HAS_SECURE_API 1
#endif
#if defined (TX_USE_SFML)
#define _GLIBCXX_NDEBUG
#endif
#ifndef _GLIBCXX_NDEBUG // TXLib enables _GLIBCXX_DEBUG by default. When using third-party libraries
#define _GLIBCXX_DEBUG // compiled without _GLIBCXX_DEBUG (SFML, for example), #define _GLIBCXX_NDEBUG
#define _GLIBCXX_DEBUG_PEDANTIC // *before* including TXLib.h.
#endif
#if defined (_WIN64) // removed in x86 because printf ("%lg", double) failure, this prints 0 always
#ifndef __USE_MINGW_ANSI_STDIO
#define __USE_MINGW_ANSI_STDIO 1
#endif
#endif
template <typename T>
inline T _txNOP (T value) { return value; } // To suppress performance warnings in assert etc.
// From MinGW\include\float.h which is replaced by MinGW\lib\gcc\i686-pc-mingw32\x.x.x\include\float.h
extern "C" __declspec (dllimport) unsigned __cdecl _controlfp (unsigned control, unsigned mask);
extern "C" void __cdecl _fpreset ();
#else
#define __attribute__( attr )
#define _txNOP( value ) ( value )
#endif
//-----------------------------------------------------------------------------------------------------------------
#if defined (__clang__) || defined (__clang_major__)
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic warning "-Wall"
#pragma clang diagnostic warning "-Weffc++"
#pragma clang diagnostic warning "-Wextra"
#pragma clang diagnostic warning "-Wcast-qual"
#pragma clang diagnostic warning "-Wchar-subscripts"
#pragma clang diagnostic warning "-Wconversion"
#pragma clang diagnostic warning "-Wctor-dtor-privacy"
#pragma clang diagnostic warning "-Wempty-body"
#pragma clang diagnostic warning "-Wfloat-equal"
#pragma clang diagnostic warning "-Wformat"
#pragma clang diagnostic warning "-Wformat-nonliteral"
#pragma clang diagnostic warning "-Wformat-security"
#pragma clang diagnostic warning "-Wmissing-declarations"
#pragma clang diagnostic warning "-Wnon-virtual-dtor"
#pragma clang diagnostic warning "-Woverloaded-virtual"
#pragma clang diagnostic warning "-Wpacked"
#pragma clang diagnostic warning "-Wpointer-arith"
#pragma clang diagnostic warning "-Wredundant-decls"
#pragma clang diagnostic warning "-Wshadow"
#pragma clang diagnostic warning "-Wsign-promo"
#pragma clang diagnostic warning "-Wstrict-aliasing"
#pragma clang diagnostic warning "-Wstrict-overflow"
#pragma clang diagnostic warning "-Wswitch-default"
#pragma clang diagnostic warning "-Wswitch-enum"
#pragma clang diagnostic warning "-Wunused"
#pragma clang diagnostic warning "-Wvariadic-macros"
#pragma clang diagnostic ignored "-Winvalid-source-encoding"
#pragma clang diagnostic ignored "-Wunused-const-variable"
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic warning "-Wunknown-pragmas"
//{ These warning settings for TXLib.h only and will be re-enabled at end of file:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wcast-align"
#pragma clang diagnostic ignored "-Wfloat-conversion"
#pragma clang diagnostic ignored "-Wmissing-braces"
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
#pragma clang diagnostic ignored "-Wsign-compare"
#pragma clang diagnostic ignored "-Wsign-conversion"
#pragma clang diagnostic ignored "-Wstring-plus-int"
#pragma clang diagnostic ignored "-Wundef"
#pragma clang diagnostic ignored "-Wunused-function"
#pragma clang diagnostic ignored "-Wunused-value"
#pragma clang diagnostic warning "-Wunknown-pragmas"
//{ CLang-Tidy options
//
// *,-cert-dcl50-cpp,-cert-dcl58-cpp,-cert-err52-cpp,-cert-err58-cpp,-cert-flp30-c,-cert-msc30-c,-cert-msc32-c,
// -cert-msc50-cpp,-cert-msc51-cpp,-clang-analyzer-core.DivideZero,-cppcoreguidelines-avoid-c-arrays,
// -cppcoreguidelines-avoid-goto,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-macro-usage,
// -cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-no-malloc,
// -cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,
// -cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-cstyle-cast,-cppcoreguidelines-pro-type-union-access,
// -cppcoreguidelines-pro-type-vararg,-fuchsia-default-arguments-calls,-fuchsia-default-arguments-declarations,
// -fuchsia-overloaded-operator,-google-build-using-namespace,-google-global-names-in-headers,-google-runtime-int,
// -google-readability-braces-around-statements,-google-readability-casting,-google-readability-namespace-comments,
// -hicpp-avoid-c-arrays,-hicpp-avoid-goto,-hicpp-braces-around-statements,-hicpp-deprecated-headers,-hicpp-no-array-decay,
// -hicpp-signed-bitwise,-hicpp-use-equals-delete,-hicpp-use-nullptr,-hicpp-vararg,-llvm-include-order,-hicpp-no-malloc,
// -llvm-namespace-comment,-misc-non-private-member-variables-in-classes,-modernize-avoid-c-arrays,-modernize-use-auto,
// -modernize-deprecated-headers,-modernize-raw-string-literal,-modernize-use-default-member-init,-hicpp-use-auto,
// -modernize-use-equals-delete,-modernize-use-nullptr,-modernize-use-trailing-return-type,-modernize-use-using,
// -readability-braces-around-statements,-readability-else-after-return,-readability-implicit-bool-conversion,
// -readability-isolate-declaration,-readability-magic-numbers,-readability-named-parameter,-modernize-loop-convert
//}
//}
#endif
//-----------------------------------------------------------------------------------------------------------------
#if defined (_MSC_VER)
#pragma warning (push, 4) // Set maximum warning level. This 'push' is to set the level only. It will NOT be popped.
#pragma warning (disable: 4616) // #pragma warning: warning number 'n' not a valid compiler warning
#pragma warning (disable: 4514) // Unreferenced inline function has been removed
#pragma warning (disable: 4710) // Function not inlined
#pragma warning (disable: 4786) // Identifier was truncated to '255' characters in the debug information
#pragma warning (error: 4715) // Not all control paths return a value
#pragma warning (default: 4616) // #pragma warning: warning number 'n' not a valid compiler warning
// These warning settings for TXLib.h only and will be re-enabled at end of file:
#pragma warning (push)
#pragma warning (disable: 4616) // #pragma warning: warning number 'n' not a valid compiler warning
#pragma warning (disable: 4091) // 'typedef': ignored on left of '...' when no variable is declared
#pragma warning (disable: 4124) // Using __fastcall with stack checking is ineffective
#pragma warning (disable: 4127) // Conditional expression is constant
#pragma warning (disable: 4200) // Nonstandard extension used: zero-sized array in struct/union
#pragma warning (disable: 4201) // Nonstandard extension used: nameless struct/union
#pragma warning (disable: 4351) // New behavior: elements of array will be default initialized
#pragma warning (disable: 4480) // Nonstandard extension used: specifying underlying type for enum 'type'
#pragma warning (disable: 4481) // Nonstandard extension used: override specifier 'override'
#pragma warning (disable: 4555) // Result of expression not used
#pragma warning (disable: 4611) // Interaction between '_setjmp' and C++ object destruction is non-portable
#pragma warning (disable: 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
#pragma warning (disable: 6269) // Possibly incorrect order of operations: dereference ignored
#pragma warning (disable: 6285) // (<non-zero constant>) || (<non-zero constant>) is always a non-zero constant. Did you intend to use bitwize-and operator?
#pragma warning (disable: 6319) // Use of the comma-operator in a tested expression causes the left argument to be ignored when it has no side-effects
#pragma warning (disable: 6326) // Potential comparison of a constant with another constant
#pragma warning (disable: 26135) // Missing locking annotation
#pragma warning (disable: 26400) // Do not assign the result of an allocation or a function call with an owner<T> return value to a raw pointer, use owner<T> instead (i.11).
#pragma warning (disable: 26401) // Do not delete a raw pointer that is not an owner<T> (i.11).
#pragma warning (disable: 26403) // Reset or explicitly delete an owner<T> pointer 'name' (r.3).
#pragma warning (disable: 26408) // Avoid malloc() and free(), prefer the nothrow version of new with delete (r.10).
#pragma warning (disable: 26409) // Avoid calling new and delete explicitly, use std::make_unique<T> instead (r.11).
#pragma warning (disable: 26426) // Global initializer calls a non-constexpr function 'name' (i.22).
#pragma warning (disable: 26429) // Symbol 'name' is never tested for nullness, it can be marked as not_null (f.23).
#pragma warning (disable: 26430) // Symbol 'name' is not tested for nullness on all paths (f.23).
#pragma warning (disable: 26432) // If you define or delete any default operation in the type 'struct 'name'', define or delete them all (c.21).
#pragma warning (disable: 26435) // Function 'name' should specify exactly one of 'virtual', 'override', or 'final' (c.128).
#pragma warning (disable: 26438) // Avoid 'goto' (es.76).
#pragma warning (disable: 26440) // Function 'name' can be declared 'noexcept' (f.6).
#pragma warning (disable: 26446) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4).
#pragma warning (disable: 26447) // The function is declared 'noexcept' but calls function 'func' which may throw exceptions (f.6).
#pragma warning (disable: 26448) // Consider using gsl::finally if final action is intended (gsl.util).
#pragma warning (disable: 26451) // Arithmetic overflow: Using operator 'op' on a n-byte value and then casting the result to a m-byte value. Cast the value to the wider type before calling operator 'op' to avoid overflow (io.2).
#pragma warning (disable: 26455) // Default constructor may not throw. Declare it 'noexcept' (f.6).
#pragma warning (disable: 26460) // The reference argument 'stream' for function 'name' can be marked as const (con.3).
#pragma warning (disable: 26461) // The pointer argument 'name' for function 'name' can be marked as a pointer to const (con.3).
#pragma warning (disable: 26462) // The value pointed to by 'name' is assigned only once, mark it as a pointer to const (con.4).
#pragma warning (disable: 26475) // Do not use function style C-casts (es.49).
#pragma warning (disable: 26477) // Use 'nullptr' rather than 0 or NULL (es.47).
#pragma warning (disable: 26481) // Don't use pointer arithmetic. Use span instead (bounds.1).
#pragma warning (disable: 26482) // Only index into arrays using constant expressions (bounds.2).
#pragma warning (disable: 26483) // Value 'value' is outside the bounds (min, max) of variable 'name'. Only index into arrays using constant expressions that are within bounds of the array (bounds.2).
#pragma warning (disable: 26485) // Expression 'expr': No array to pointer decay (bounds.3).
#pragma warning (disable: 26486) // Don't pass a pointer that may be invalid to a function. Parameter 'n' 'name' in call to 'name' may be invalid (lifetime.3).
#pragma warning (disable: 26487) // Don't return a pointer 'name' that may be invalid (lifetime.4).
#pragma warning (disable: 26488) // Do not dereference a potentially null pointer: 'name'. 'name' was null at line 'n' (lifetime.1).
#pragma warning (disable: 26489) // Don't dereference a pointer that may be invalid: 'name'. 'name' may have been invalidated at line 'n' (lifetime.1).
#pragma warning (disable: 26490) // Don't use reinterpret_cast (type.1).
#pragma warning (disable: 26492) // Don't use const_cast to cast away const or volatile (type.3).
#pragma warning (disable: 26493) // Don't use C-style casts (type.4).
#pragma warning (disable: 26496) // The variable 'name' is assigned only once, mark it as const (con.4).
#pragma warning (disable: 26497) // The function 'name' could be marked constexpr if compile-time evaluation is desired (f.4).
#pragma warning (disable: 26812) // The enum type 'type' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).
#pragma warning (disable: 26814) // The const variable 'name' can be computed at compile-time. Consider using constexpr (con.5).
#pragma warning (disable: 28125) // The function must be called from within a try/except block
#pragma warning (disable: 28159) // Consider using another function instead
#pragma warning (default: 4616) // #pragma warning: warning number 'n' not a valid compiler warning
#define _tx_thread __declspec (thread)
#define _tx_decltype(value) decltype (value)
#if !defined (_CLANG_VER)
#pragma setlocale ("russian") // Set source file encoding, see also _TX_CODEPAGE
#if !defined (NDEBUG)
#pragma check_stack ( on) // Turn on stack probes at runtime
#pragma strict_gs_check (push, on) // Detects stack buffer overruns
#endif
#endif
#define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES 1
#endif
//-----------------------------------------------------------------------------------------------------------------
#if defined (__INTEL_COMPILER)
#pragma warning (disable: 174) // Remark: expression has no effect
#pragma warning (disable: 304) // Remark: access control not specified ("public" by default)
#pragma warning (disable: 444) // Remark: destructor for base class "..." is not virtual
#pragma warning (disable: 522) // Remark: function "..." redeclared "inline" after being called
#pragma warning (disable: 981) // Remark: operands are evaluated in unspecified order
#pragma warning (disable: 1684) // Conversion from pointer to same-sized integral type (potential portability problem)
#endif
//-----------------------------------------------------------------------------------------------------------------
#if (defined (_GCC_VER) && (_GCC_VER < 472) || \
defined (_MSC_VER) && (_MSC_VER < 1600)) // Minimum requirements are now GCC 4.7.2 or MSVC 10.0 (2010)
#ifdef __GNUC__
#error
#error ---------------------------------------------------------------------------------------
#endif
#error TXLib.h: This version will NOT work with GCC < 4.7.2 or MS Visual Studio < 2010, sorry.
#error
#error Please use TXLib.h previous stable version/revision OR upgrade your compiler.
#error ---------------------------------------------------------------------------------------
#error
#endif
//-----------------------------------------------------------------------------------------------------------------
#if defined (_GCC_VER) && (_GCC_VER >= 492)
#if defined (TX_USE_SPEAK) && !__has_include (<SAPI.h>)
#ifdef __GNUC__
#error
#error ---------------------------------------------------------------------------------------
#endif
#error You have defined TX_USE_SPEAK, but your compiler do NOT have the library <SAPI.h>.
#error
#error Please use compiler library set with SAPI.h included. SAPI is Microsoft Speech API
#error nesessary for txSpeak() to work.
#error ---------------------------------------------------------------------------------------
#error
#endif
#endif
//-----------------------------------------------------------------------------------------------------------------
#if !defined (WINVER)
#define WINVER 0x0500 // Defaults to Windows 2000
#define WINDOWS_ENABLE_CPLUSPLUS // Allow use of type-limit macros in <basetsd.h>,
#endif // they are allowed by default if WINVER >= 0x0600.
#if !defined (_WIN32_WINNT)
#define _WIN32_WINNT WINVER // Defaults to the same as WINVER
#endif
#if !defined (_WIN32_IE)
#define _WIN32_IE WINVER // Defaults to the same as WINVER
#endif
#define stristr( str1, str2 ) Win32::StrStrIA ((str1), (str2))
#define stristrw( str1, str2 ) Win32::StrStrIW ((str1), (str2))
//-----------------------------------------------------------------------------------------------------------------
#define _USE_MATH_DEFINES 1 // Math.h's M_PI etc.
#define __STDC_FORMAT_MACROS 1 // PRIu64 and other PR... macros
#define __STDC_WANT_LIB_EXT1__ 1 // String and output *_s functions
#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS // Wow, how long. Kudos, Clang
#define _ALLOW_RTCc_IN_STL 1 // MSVC C2338: /RTCc rejects conformant code, so it isn't supported by libc.
#define NOMINMAX 1 // Preventing 'min' and 'max' defines in Windows.h
#if defined (_DEBUG)
#define _SECURE_SCL 1 // Enable checked STL iterators to throw an exception on incorrect use
#define _HAS_ITERATOR_DEBUGGING 1
#define _LIBCPP_DEBUG 1
#endif
#if defined (_MSC_VER) && defined (_DEBUG)
#define _CRTDBG_MAP_ALLOC // Enable MSVCRT debug heap
#define _new_dbg new (_NORMAL_BLOCK, __FILE__, __LINE__)
#define NEW new (_NORMAL_BLOCK, __FILE__, __LINE__)
#else
#define _new_dbg new
#define NEW new
#endif
#if !( defined (_MSC_VER) && (_MSC_VER < 1900) ) // MSVC 2015
#define _SECURE_SCL_THROWS 1
#endif
#define tx_noreturn __attribute__ (( noreturn ))
#define tx_nodiscard __attribute__ (( warn_unused_result ))
#define tx_deprecated __attribute__ (( deprecated ))
#define tx_printfy( formatArgN ) __attribute__ (( format (printf, (formatArgN), (formatArgN)+1) ))
#define tx_scanfy( formatArgN ) __attribute__ (( format (scanf, (formatArgN), (formatArgN)+1) ))
#if defined (_TX_CPP11)
#define _tx_delete = delete
#define _tx_default = default
#define _tx_override override
#define _tx_final final
#else
#define _tx_delete
#define _tx_default
#define _tx_override
#define _tx_final
#endif
namespace std { enum nomeow_t { nomeow }; } // Vital addition to the C++ standard. TODO: Should contact C++ std committee.
//-----------------------------------------------------------------------------------------------------------------
//! @} @endcond
//}
//-----------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------
//{ The Includes
//-----------------------------------------------------------------------------------------------------------------
#if defined (_MSC_VER)
#pragma warning (push, 3) // MSVC: At level /Wall, some std headers emit warnings... O_o
#pragma warning (disable: 4365) // 'argument': conversion from 'long' to 'unsigned int', signed/unsigned mismatch
#pragma warning (disable: 4005) // 'name': macro redefinition
#endif
//-----------------------------------------------------------------------------------------------------------------
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <float.h>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <iomanip>
#if !defined (__CYGWIN__)
#include <conio.h>
#include <direct.h>
#endif
#if defined (TX_COMPILED)
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <mmsystem.h>
//-----------------------------------------------------------------------------------------------------------------
//{ Compiler- and platform-specific
//! @name Адаптация к компиляторам и платформам
//-----------------------------------------------------------------------------------------------------------------
#if defined (_MSC_VER)
#pragma warning (pop) // MSVC: Restore max level
#endif
#if defined (__STRICT_ANSI__UNDEFINED)
#define __STRICT_ANSI__ // Redefine back
#endif
#if !defined (_TRUNCATE) || defined (__CYGWIN__) || defined (_MEMORY_S_DEFINED)
#define strncpy_s( dest, sizeof_dest, src, count ) ( strncpy ((dest), (src), MIN ((count), (sizeof_dest))) )
#define wcsncpy_s( dest, sizeof_dest, src, count ) ( wcsncpy ((dest), (src), MIN ((count), (sizeof_dest))) )
#define strncat_s( dest, sizeof_dest, src, count ) ( strncat ((dest), (src), MIN ((count), (sizeof_dest))) )
#define strerror_s( buf, sizeof_buf, code ) ( strncpy ((buf), strerror ((int)(code)), (sizeof_buf)-1) )
#define strtok_s( buf, delim, ctx ) ( (void)(ctx), strtok ((buf), (delim)) )
#define fopen_s( file, name, mode ) ( *(file) = fopen ((name), (mode)) )
#define _strlwr_s( str, sizeof_str ) ( _strlwr (str) )
#define ctime_s( buf, sizeof_buf, time ) ( strncpy ((buf), ctime (time), (sizeof_buf)-1) )
#define _controlfp_s( oldCtl, newCtl, mask ) ( assert (oldCtl), *(oldCtl) = _controlfp (newCtl, mask), 0 )
#define _snprintf_s snprintf
#define _vsnprintf_s( str, sz, trunc, format, arg ) _vsnprintf (str, sz, format, arg)
#endif
#if !( defined (_MSC_VER) || defined (__STDC_LIB_EXT1__) )
#define getenv_s( sz, buf, sizeof_buf, name ) ( (void)(sz), strncpy ((buf), getenv (name), (sizeof_buf)-1) )
#endif
#if defined (__CYGWIN__)
#undef __STRICT_ANSI__
typedef void _exception;
#define _O_TEXT O_TEXT
#define _fdopen fdopen
#define _flushall() fflush (NULL)
#define _getcwd getcwd
#define _getpid getpid
#define _stricmp strcasecmp
#define _strlwr strlwr
#define _strnicmp strncasecmp
#define _unlink unlink
#define _vsnprintf vsnprintf
#define _access access
#define _strdup strdup
#define getch _getch
#define putch _putch
#define kbhit _kbhit
#endif
#if !defined (PRId64) || \
defined (_GCC_VER) && (_GCC_VER == 492) && !defined (_WIN64) // Dev-CPP 5.11: TDM-GCC 4.9.2 MinGW64 with -m32
#undef PRId64
#undef PRIi64
#undef PRIo64
#undef PRIu64
#undef PRIx64
#undef PRIX64
#define PRId64 "I64d"
#define PRIi64 "I64i"
#define PRIo64 "I64o"
#define PRIu64 "I64u"
#define PRIx64 "I64x"
#define PRIX64 "I64X"
#endif
//}
//-----------------------------------------------------------------------------------------------------------------
//}
//-----------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------
//{ The namespaces
//-----------------------------------------------------------------------------------------------------------------
//{----------------------------------------------------------------------------------------------------------------
//! @ingroup Technical
//! @brief Анонимное пространство имен для защиты от конфликтов при сборке многофайлового проекта.
//}----------------------------------------------------------------------------------------------------------------
#ifdef FOR_DOXYGEN_ONLY
namespace { namespace TX { }}
#endif
/*! @cond INTERNAL */
//-----------------------------------------------------------------------------------------------------------------
#if defined (TX_COMPILED) && defined (TX_COMPILING)
#undef TX_COMPILED
#endif
#if !defined (TX_COMPILED) && !defined (TX_COMPILING)
#define _TX_BEGIN_NAMESPACE namespace { namespace TX {
#define _TX_END_NAMESPACE } }
#else
#define _TX_BEGIN_NAMESPACE namespace TX {
#define _TX_END_NAMESPACE }
#endif
//-----------------------------------------------------------------------------------------------------------------
_TX_BEGIN_NAMESPACE
/*! @endcond */