05.11.2011 - stable version, 0.1.0, self-test program, work at GCC 2.95 - 4.5, VC 2010, MinGW, Linux, Windows, QNX

This commit is contained in:
peri4
2011-12-05 23:51:02 +03:00
parent e25553b97b
commit 74b4173c4c
43 changed files with 1495 additions and 694 deletions

View File

@@ -1,7 +1,12 @@
#ifndef PIINCLUDES_H
#define PIINCLUDES_H
#if __WIN32__ || __WIN64__ || WIN32 || WIN64
#define PIP_VERSION 0x000100
#define PIP_VERSION_MAJOR (PIP_VERSION & 0xFF0000) >> 16
#define PIP_VERSION_MINOR (PIP_VERSION & 0xFF00) >> 8
#define PIP_VERSION_REVISION PIP_VERSION & 0xFF
#if WIN32 || WIN64 || _WIN32 || _WIN64 || __WIN32__ || __WIN64__
# define WINDOWS
#endif
#if __QNX__ || __QNXNTO__
@@ -28,17 +33,17 @@
#include <iostream>
#ifdef CC_GCC
#include <unistd.h>
# include <unistd.h>
#endif
#include <stdarg.h>
#include <stddef.h>
#ifndef QNX
#include <cstdio>
#include <cstdlib>
#include <clocale>
# include <cstdio>
# include <cstdlib>
# include <clocale>
#else
#include <stdio.h>
#include <locale.h>
# include <stdio.h>
# include <locale.h>
#endif
#include <stdlib.h>
#include <sys/stat.h>
@@ -56,10 +61,13 @@
#include <stack>
#include <set>
#ifdef WINDOWS
#include <conio.h>
#include <windows.h>
#include <wincon.h>
# include <conio.h>
# include <windows.h>
# include <wincon.h>
#endif
#include "pimonitor.h"
extern PIMonitor piMonitor;
#define FOREVER for (;;)
#define FOREVER_WAIT FOREVER msleep(1);
@@ -94,9 +102,9 @@ typedef std::basic_string<wchar_t> wstring;
static bool isPIInit = false;
class piInit {
class PIInit {
public:
piInit() {
PIInit() {
if (isPIInit) return;
isPIInit = true;
#ifdef LINUX
@@ -109,15 +117,14 @@ public:
setlocale(LC_ALL, "");
#endif
}
~piInit() {
~PIInit() {
//if (currentLocale_t != 0) freelocale(currentLocale_t);
}
};
static piInit __pi_init;
static PIInit piInit;
static lconv * currentLocale = std::localeconv();
#ifdef CC_VC
inline string errorString() {char buff[1024]; strerror_s(buff, 1024, GetLastError()); return string(buff);}
#else
@@ -189,4 +196,6 @@ inline string dtos(const double num) {
#endif
return string(ch); };
inline string PIPVersion() {return itos(PIP_VERSION_MAJOR) + "." + itos(PIP_VERSION_MINOR) + "." + itos(PIP_VERSION_REVISION);}
#endif // PIINCLUDES_H