1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Update sqconfig.h

This commit is contained in:
Sandu Liviu Catalin 2021-02-01 00:08:02 +02:00
parent 07d215c428
commit 66599b5df3

View File

@ -1,50 +1,49 @@
#ifdef __cplusplus
#include <cstddef>
#include <cstdint>
#else
#include <stddef.h>
#include <stdint.h>
#endif
#ifdef _SQ64 #ifdef _SQ64
typedef int64_t SQInteger;
typedef uint64_t SQUnsignedInteger;
typedef size_t SQHash; /*should be the same size of a pointer*/
#ifdef _MSC_VER typedef int32_t SQInt32;
typedef __int64 SQInteger; typedef uint32_t SQUnsignedInteger32;
typedef unsigned __int64 SQUnsignedInteger;
typedef unsigned __int64 SQHash; /*should be the same size of a pointer*/
#else #else
typedef long long SQInteger; typedef int32_t SQInteger;
typedef unsigned long long SQUnsignedInteger; typedef uint32_t SQUnsignedInteger;
typedef unsigned long long SQHash; /*should be the same size of a pointer*/ typedef size_t SQHash; /*should be the same size of a pointer*/
#endif
typedef int SQInt32; typedef int32_t SQInt32; /*must be 32 bits(also on 64bits processors)*/
typedef unsigned int SQUnsignedInteger32; typedef uint32_t SQUnsignedInteger32; /*must be 32 bits(also on 64bits processors)*/
#else
typedef int SQInteger;
typedef int SQInt32; /*must be 32 bits(also on 64bits processors)*/
typedef unsigned int SQUnsignedInteger32; /*must be 32 bits(also on 64bits processors)*/
typedef unsigned int SQUnsignedInteger;
typedef unsigned int SQHash; /*should be the same size of a pointer*/
#endif #endif
#ifdef SQUSEDOUBLE #ifdef SQUSEDOUBLE
typedef double SQFloat; typedef double SQFloat;
#else #else
typedef float SQFloat; typedef float SQFloat;
#endif #endif
#if defined(SQUSEDOUBLE) && !defined(_SQ64) || !defined(SQUSEDOUBLE) && defined(_SQ64) #if defined(SQUSEDOUBLE) && !defined(_SQ64) || !defined(SQUSEDOUBLE) && defined(_SQ64)
#ifdef _MSC_VER typedef int64_t SQRawObjectVal; //must be 64bits
typedef __int64 SQRawObjectVal; //must be 64bits #define SQ_OBJECT_RAWINIT() { _unVal.raw = 0; }
#else #else
typedef long long SQRawObjectVal; //must be 64bits typedef SQUnsignedInteger SQRawObjectVal; //is 32 bits on 32 bits builds and 64 bits otherwise
#endif #define SQ_OBJECT_RAWINIT()
#define SQ_OBJECT_RAWINIT() { _unVal.raw = 0; }
#else
typedef SQUnsignedInteger SQRawObjectVal; //is 32 bits on 32 bits builds and 64 bits otherwise
#define SQ_OBJECT_RAWINIT()
#endif #endif
#ifndef SQ_ALIGNMENT // SQ_ALIGNMENT shall be less than or equal to SQ_MALLOC alignments, and its value shall be power of 2. #ifndef SQ_ALIGNMENT // SQ_ALIGNMENT shall be less than or equal to SQ_MALLOC alignments, and its value shall be power of 2.
#if defined(SQUSEDOUBLE) || defined(_SQ64) #if defined(SQUSEDOUBLE) || defined(_SQ64)
#define SQ_ALIGNMENT 8 #define SQ_ALIGNMENT 8
#else #else
#define SQ_ALIGNMENT 4 #define SQ_ALIGNMENT 4
#endif #endif
#endif #endif
typedef void* SQUserPointer; typedef void* SQUserPointer;
@ -52,95 +51,101 @@ typedef SQUnsignedInteger SQBool;
typedef SQInteger SQRESULT; typedef SQInteger SQRESULT;
#ifdef SQUNICODE #ifdef SQUNICODE
#include <wchar.h> #include <wchar.h>
#include <wctype.h> #include <wctype.h>
typedef wchar_t SQChar; typedef wchar_t SQChar;
#define scstrcmp wcscmp #define scstrcmp wcscmp
#ifdef _WIN32
#define scsprintf _snwprintf
#else
#define scsprintf swprintf
#endif
#define scstrlen wcslen
#define scstrtod wcstod
#ifdef _SQ64
#define scstrtol wcstoll
#else
#define scstrtol wcstol
#endif
#define scstrtoul wcstoul
#define scvsprintf vswprintf
#define scstrstr wcsstr
#define scprintf wprintf
#ifdef _WIN32 #ifdef _WIN32
#define WCHAR_SIZE 2 #define scsprintf _snwprintf
#define WCHAR_SHIFT_MUL 1 #else
#define MAX_CHAR 0xFFFF #define scsprintf swprintf
#else #endif
#define WCHAR_SIZE 4
#define WCHAR_SHIFT_MUL 2
#define MAX_CHAR 0xFFFFFFFF
#endif
#define _SC(a) L##a #define scstrlen wcslen
#define scstrtod wcstod
#ifdef _SQ64
#define scstrtol wcstoll
#else
#define scstrtol wcstol
#endif
#define scisspace iswspace #define scstrtoul wcstoul
#define scisdigit iswdigit #define scvsprintf vswprintf
#define scisprint iswprint #define scstrstr wcsstr
#define scisxdigit iswxdigit #define scprintf wprintf
#define scisalpha iswalpha
#define sciscntrl iswcntrl
#define scisalnum iswalnum
#ifdef _WIN32
#define WCHAR_SIZE 2
#define WCHAR_SHIFT_MUL 1
#define MAX_CHAR 0xFFFF
#else
#define WCHAR_SIZE 4
#define WCHAR_SHIFT_MUL 2
#define MAX_CHAR 0xFFFFFFFF
#endif
#define sq_rsl(l) ((l)<<WCHAR_SHIFT_MUL) #define _SC(a) L##a
#define scisspace iswspace
#define scisdigit iswdigit
#define scisprint iswprint
#define scisxdigit iswxdigit
#define scisalpha iswalpha
#define sciscntrl iswcntrl
#define scisalnum iswalnum
#define sq_rsl(l) ((l)<<WCHAR_SHIFT_MUL)
#else #else
typedef char SQChar; typedef char SQChar;
#define _SC(a) a #define _SC(a) a
#define scstrcmp strcmp #define scstrcmp strcmp
#ifdef _MSC_VER
#define scsprintf _snprintf
#else
#define scsprintf snprintf
#endif
#define scstrlen strlen
#define scstrtod strtod
#ifdef _SQ64
#ifdef _MSC_VER
#define scstrtol _strtoi64
#else
#define scstrtol strtoll
#endif
#else
#define scstrtol strtol
#endif
#define scstrtoul strtoul
#define scvsprintf vsnprintf
#define scstrstr strstr
#define scisspace isspace
#define scisdigit isdigit
#define scisprint isprint
#define scisxdigit isxdigit
#define sciscntrl iscntrl
#define scisalpha isalpha
#define scisalnum isalnum
#define scprintf printf
#define MAX_CHAR 0xFF
#define sq_rsl(l) (l) #ifdef _MSC_VER
#define scsprintf _snprintf
#else
#define scsprintf snprintf
#endif
#define scstrlen strlen
#define scstrtod strtod
#ifdef _SQ64
#ifdef _MSC_VER
#define scstrtol _strtoi64
#else
#define scstrtol strtoll
#endif
#else
#define scstrtol strtol
#endif
#define scstrtoul strtoul
#define scvsprintf vsnprintf
#define scstrstr strstr
#define scisspace isspace
#define scisdigit isdigit
#define scisprint isprint
#define scisxdigit isxdigit
#define sciscntrl iscntrl
#define scisalpha isalpha
#define scisalnum isalnum
#define scprintf printf
#define MAX_CHAR 0xFF
#define sq_rsl(l) (l)
#endif #endif
#ifdef _SQ64 #ifdef _SQ64
#define _PRINT_INT_PREC _SC("ll") #define _PRINT_INT_PREC _SC("ll")
#define _PRINT_INT_FMT _SC("%lld") #define _PRINT_INT_FMT _SC("%lld")
#else #else
#define _PRINT_INT_FMT _SC("%d") #define _PRINT_INT_FMT _SC("%d")
#endif #endif