mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-02-03 16:39:08 +00:00
chore(build): mark all API functions with calling convention (#69)
This commit is contained in:
parent
dc9f9c1958
commit
4fa6599807
15 changed files with 220 additions and 207 deletions
|
|
@ -3,15 +3,15 @@
|
|||
#include "storm/Memory.hpp"
|
||||
#include <cstring>
|
||||
|
||||
void SBigAdd(BigData* a, BigData* b, BigData* c) {
|
||||
void STORMAPI SBigAdd(BigData* a, BigData* b, BigData* c) {
|
||||
Add(a->Primary(), b->Primary(), c->Primary());
|
||||
}
|
||||
|
||||
void SBigAnd(BigData* a, BigData* b, BigData* c) {
|
||||
void STORMAPI SBigAnd(BigData* a, BigData* b, BigData* c) {
|
||||
And(a->Primary(), b->Primary(), c->Primary());
|
||||
}
|
||||
|
||||
void SBigBitLen(BigData* num, uint32_t* len) {
|
||||
void STORMAPI SBigBitLen(BigData* num, uint32_t* len) {
|
||||
auto& buffer = num->Primary();
|
||||
buffer.Trim();
|
||||
|
||||
|
|
@ -28,23 +28,23 @@ void SBigBitLen(BigData* num, uint32_t* len) {
|
|||
*len = (index * 32) + bitIndex + 1;
|
||||
}
|
||||
|
||||
int32_t SBigCompare(BigData* a, BigData* b) {
|
||||
int32_t STORMAPI SBigCompare(BigData* a, BigData* b) {
|
||||
return Compare(a->Primary(), b->Primary());
|
||||
}
|
||||
|
||||
void SBigCopy(BigData* a, BigData* b) {
|
||||
void STORMAPI SBigCopy(BigData* a, BigData* b) {
|
||||
a->m_primary = b->m_primary;
|
||||
}
|
||||
|
||||
void SBigDec(BigData* a, BigData* b) {
|
||||
void STORMAPI SBigDec(BigData* a, BigData* b) {
|
||||
Sub(a->m_primary, b->m_primary, 1);
|
||||
}
|
||||
|
||||
void SBigDel(BigData* num) {
|
||||
void STORMAPI SBigDel(BigData* num) {
|
||||
delete num;
|
||||
}
|
||||
|
||||
void SBigDiv(BigData* a, BigData* b, BigData* c) {
|
||||
void STORMAPI SBigDiv(BigData* a, BigData* b, BigData* c) {
|
||||
uint32_t allocCount = 0;
|
||||
BigBuffer& buf = a->Stack().Alloc(&allocCount);
|
||||
|
||||
|
|
@ -53,39 +53,39 @@ void SBigDiv(BigData* a, BigData* b, BigData* c) {
|
|||
a->Stack().Free(allocCount);
|
||||
}
|
||||
|
||||
void SBigFromBinary(BigData* num, const void* data, uint32_t bytes) {
|
||||
void STORMAPI SBigFromBinary(BigData* num, const void* data, uint32_t bytes) {
|
||||
FromBinary(num->Primary(), data, bytes);
|
||||
}
|
||||
|
||||
void SBigFromStr(BigData* num, const char *str) {
|
||||
void STORMAPI SBigFromStr(BigData* num, const char *str) {
|
||||
FromStr(num->Primary(), str);
|
||||
}
|
||||
|
||||
void SBigFromUnsigned(BigData* num, uint32_t val) {
|
||||
void STORMAPI SBigFromUnsigned(BigData* num, uint32_t val) {
|
||||
FromUnsigned(num->Primary(), val);
|
||||
}
|
||||
|
||||
void SBigInc(BigData* a, BigData* b) {
|
||||
void STORMAPI SBigInc(BigData* a, BigData* b) {
|
||||
Add(a->Primary(), b->Primary(), 1);
|
||||
}
|
||||
|
||||
int32_t SBigIsEven(BigData* a) {
|
||||
int32_t STORMAPI SBigIsEven(BigData* a) {
|
||||
return IsEven(a->Primary());
|
||||
}
|
||||
|
||||
int32_t SBigIsOdd(BigData* a) {
|
||||
int32_t STORMAPI SBigIsOdd(BigData* a) {
|
||||
return IsOdd(a->Primary());
|
||||
}
|
||||
|
||||
int32_t SBigIsOne(BigData* a) {
|
||||
int32_t STORMAPI SBigIsOne(BigData* a) {
|
||||
return IsOne(a->Primary());
|
||||
}
|
||||
|
||||
int32_t SBigIsZero(BigData* a) {
|
||||
int32_t STORMAPI SBigIsZero(BigData* a) {
|
||||
return IsZero(a->Primary());
|
||||
}
|
||||
|
||||
void SBigMod(BigData* a, BigData* b, BigData* c) {
|
||||
void STORMAPI SBigMod(BigData* a, BigData* b, BigData* c) {
|
||||
uint32_t allocCount = 0;
|
||||
auto& scratch = a->Stack().Alloc(&allocCount);
|
||||
|
||||
|
|
@ -94,43 +94,43 @@ void SBigMod(BigData* a, BigData* b, BigData* c) {
|
|||
a->Stack().Free(allocCount);
|
||||
}
|
||||
|
||||
void SBigMul(BigData* a, BigData* b, BigData* c) {
|
||||
void STORMAPI SBigMul(BigData* a, BigData* b, BigData* c) {
|
||||
Mul(a->Primary(), b->Primary(), c->Primary(), a->Stack());
|
||||
}
|
||||
|
||||
void SBigNew(BigData** num) {
|
||||
void STORMAPI SBigNew(BigData** num) {
|
||||
*num = STORM_NEW(BigData);
|
||||
}
|
||||
|
||||
void SBigNot(BigData* a, BigData* b) {
|
||||
void STORMAPI SBigNot(BigData* a, BigData* b) {
|
||||
Not(a->Primary(), b->Primary());
|
||||
}
|
||||
|
||||
void SBigOr(BigData* a, BigData* b, BigData* c) {
|
||||
void STORMAPI SBigOr(BigData* a, BigData* b, BigData* c) {
|
||||
Or(a->Primary(), b->Primary(), c->Primary());
|
||||
}
|
||||
|
||||
void SBigPowMod(BigData* a, BigData* b, BigData* c, BigData* d) {
|
||||
void STORMAPI SBigPowMod(BigData* a, BigData* b, BigData* c, BigData* d) {
|
||||
PowMod(a->Primary(), b->Primary(), c->Primary(), d->Primary(), a->Stack());
|
||||
}
|
||||
|
||||
void SBigShl(BigData* a, BigData* b, uint32_t shift) {
|
||||
void STORMAPI SBigShl(BigData* a, BigData* b, uint32_t shift) {
|
||||
Shl(a->Primary(), b->Primary(), shift);
|
||||
}
|
||||
|
||||
void SBigShr(BigData* a, BigData* b, uint32_t shift) {
|
||||
void STORMAPI SBigShr(BigData* a, BigData* b, uint32_t shift) {
|
||||
Shr(a->Primary(), b->Primary(), shift);
|
||||
}
|
||||
|
||||
void SBigSquare(BigData* a, BigData* b) {
|
||||
void STORMAPI SBigSquare(BigData* a, BigData* b) {
|
||||
Square(a->Primary(), b->Primary(), a->Stack());
|
||||
}
|
||||
|
||||
void SBigSub(BigData* a, BigData* b, BigData* c) {
|
||||
void STORMAPI SBigSub(BigData* a, BigData* b, BigData* c) {
|
||||
Sub(a->Primary(), b->Primary(), c->Primary());
|
||||
}
|
||||
|
||||
void SBigToBinaryBuffer(BigData* num, uint8_t* data, uint32_t maxBytes, uint32_t* bytes) {
|
||||
void STORMAPI SBigToBinaryBuffer(BigData* num, uint8_t* data, uint32_t maxBytes, uint32_t* bytes) {
|
||||
auto& output = num->Output();
|
||||
ToBinary(output, num->Primary());
|
||||
|
||||
|
|
@ -142,10 +142,10 @@ void SBigToBinaryBuffer(BigData* num, uint8_t* data, uint32_t maxBytes, uint32_t
|
|||
}
|
||||
}
|
||||
|
||||
void SBigToUnsigned(BigData* num, uint32_t* val) {
|
||||
void STORMAPI SBigToUnsigned(BigData* num, uint32_t* val) {
|
||||
ToUnsigned(val, num->Primary());
|
||||
}
|
||||
|
||||
void SBigXor(BigData* a, BigData* b, BigData* c) {
|
||||
void STORMAPI SBigXor(BigData* a, BigData* b, BigData* c) {
|
||||
Xor(a->Primary(), b->Primary(), c->Primary());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,64 +2,64 @@
|
|||
#define STORM_BIG_HPP
|
||||
|
||||
#include "storm/big/BigData.hpp"
|
||||
#include <cstdint>
|
||||
#include "Core.hpp"
|
||||
|
||||
void SBigAdd(BigData* a, BigData* b, BigData* c);
|
||||
void STORMAPI SBigAdd(BigData* a, BigData* b, BigData* c);
|
||||
|
||||
void SBigAnd(BigData* a, BigData* b, BigData* c);
|
||||
void STORMAPI SBigAnd(BigData* a, BigData* b, BigData* c);
|
||||
|
||||
void SBigBitLen(BigData* num, uint32_t* len);
|
||||
void STORMAPI SBigBitLen(BigData* num, uint32_t* len);
|
||||
|
||||
int32_t SBigCompare(BigData* a, BigData* b);
|
||||
int32_t STORMAPI SBigCompare(BigData* a, BigData* b);
|
||||
|
||||
void SBigCopy(BigData* a, BigData* b);
|
||||
void STORMAPI SBigCopy(BigData* a, BigData* b);
|
||||
|
||||
void SBigDec(BigData* a, BigData* b);
|
||||
void STORMAPI SBigDec(BigData* a, BigData* b);
|
||||
|
||||
void SBigDel(BigData* num);
|
||||
void STORMAPI SBigDel(BigData* num);
|
||||
|
||||
void SBigDiv(BigData* a, BigData* b, BigData* c);
|
||||
void STORMAPI SBigDiv(BigData* a, BigData* b, BigData* c);
|
||||
|
||||
void SBigFromBinary(BigData* num, const void* data, uint32_t bytes);
|
||||
void STORMAPI SBigFromBinary(BigData* num, const void* data, uint32_t bytes);
|
||||
|
||||
void SBigFromStr(BigData* num, const char* str);
|
||||
void STORMAPI SBigFromStr(BigData* num, const char* str);
|
||||
|
||||
void SBigFromUnsigned(BigData* num, uint32_t val);
|
||||
void STORMAPI SBigFromUnsigned(BigData* num, uint32_t val);
|
||||
|
||||
void SBigInc(BigData* a, BigData* b);
|
||||
void STORMAPI SBigInc(BigData* a, BigData* b);
|
||||
|
||||
int32_t SBigIsEven(BigData* a);
|
||||
int32_t STORMAPI SBigIsEven(BigData* a);
|
||||
|
||||
int32_t SBigIsOdd(BigData* a);
|
||||
int32_t STORMAPI SBigIsOdd(BigData* a);
|
||||
|
||||
int32_t SBigIsOne(BigData* a);
|
||||
int32_t STORMAPI SBigIsOne(BigData* a);
|
||||
|
||||
int32_t SBigIsZero(BigData* a);
|
||||
int32_t STORMAPI SBigIsZero(BigData* a);
|
||||
|
||||
void SBigMod(BigData* a, BigData* b, BigData* c);
|
||||
void STORMAPI SBigMod(BigData* a, BigData* b, BigData* c);
|
||||
|
||||
void SBigMul(BigData* a, BigData* b, BigData* c);
|
||||
void STORMAPI SBigMul(BigData* a, BigData* b, BigData* c);
|
||||
|
||||
void SBigNew(BigData** num);
|
||||
void STORMAPI SBigNew(BigData** num);
|
||||
|
||||
void SBigNot(BigData* a, BigData* b);
|
||||
void STORMAPI SBigNot(BigData* a, BigData* b);
|
||||
|
||||
void SBigOr(BigData* a, BigData* b, BigData* c);
|
||||
void STORMAPI SBigOr(BigData* a, BigData* b, BigData* c);
|
||||
|
||||
void SBigPowMod(BigData* a, BigData* b, BigData* c, BigData* d);
|
||||
void STORMAPI SBigPowMod(BigData* a, BigData* b, BigData* c, BigData* d);
|
||||
|
||||
void SBigShl(BigData* a, BigData* b, uint32_t shift);
|
||||
void STORMAPI SBigShl(BigData* a, BigData* b, uint32_t shift);
|
||||
|
||||
void SBigShr(BigData* a, BigData* b, uint32_t shift);
|
||||
void STORMAPI SBigShr(BigData* a, BigData* b, uint32_t shift);
|
||||
|
||||
void SBigSquare(BigData* a, BigData* b);
|
||||
void STORMAPI SBigSquare(BigData* a, BigData* b);
|
||||
|
||||
void SBigSub(BigData* a, BigData* b, BigData* c);
|
||||
void STORMAPI SBigSub(BigData* a, BigData* b, BigData* c);
|
||||
|
||||
void SBigToBinaryBuffer(BigData* num, uint8_t* data, uint32_t maxBytes, uint32_t* bytes);
|
||||
void STORMAPI SBigToBinaryBuffer(BigData* num, uint8_t* data, uint32_t maxBytes, uint32_t* bytes);
|
||||
|
||||
void SBigXor(BigData* a, BigData* b, BigData* c);
|
||||
void STORMAPI SBigXor(BigData* a, BigData* b, BigData* c);
|
||||
|
||||
void SBigToUnsigned(BigData* num, uint32_t* val);
|
||||
void STORMAPI SBigToUnsigned(BigData* num, uint32_t* val);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
17
storm/Core.hpp
Normal file
17
storm/Core.hpp
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef STORM_CORE_HPP
|
||||
#define STORM_CORE_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#ifndef STORMAPI
|
||||
#if defined(_MSC_VER)
|
||||
#define STORMAPI __stdcall
|
||||
#define STORMCDECL __cdecl
|
||||
#else
|
||||
#define STORMAPI
|
||||
#define STORMCDECL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
static uint32_t s_lasterror = ERROR_SUCCESS;
|
||||
static uint32_t s_suppress;
|
||||
|
||||
[[noreturn]] void SErrDisplayAppFatal(const char* format, ...) {
|
||||
[[noreturn]] void STORMCDECL SErrDisplayAppFatal(const char* format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
|
|
@ -20,7 +20,7 @@ static uint32_t s_suppress;
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int32_t SErrDisplayError(uint32_t errorcode, const char* filename, int32_t linenumber, const char* description, int32_t recoverable, uint32_t exitcode, uint32_t a7) {
|
||||
int32_t STORMAPI SErrDisplayError(uint32_t errorcode, const char* filename, int32_t linenumber, const char* description, int32_t recoverable, uint32_t exitcode, uint32_t a7) {
|
||||
// TODO
|
||||
|
||||
printf("\n=========================================================\n");
|
||||
|
|
@ -60,7 +60,7 @@ int32_t SErrDisplayError(uint32_t errorcode, const char* filename, int32_t linen
|
|||
}
|
||||
}
|
||||
|
||||
int32_t SErrDisplayErrorFmt(uint32_t errorcode, const char* filename, int32_t linenumber, int32_t recoverable, uint32_t exitcode, const char* format, ...) {
|
||||
int32_t STORMCDECL SErrDisplayErrorFmt(uint32_t errorcode, const char* filename, int32_t linenumber, int32_t recoverable, uint32_t exitcode, const char* format, ...) {
|
||||
char buffer[2048];
|
||||
|
||||
va_list args;
|
||||
|
|
@ -72,21 +72,21 @@ int32_t SErrDisplayErrorFmt(uint32_t errorcode, const char* filename, int32_t li
|
|||
return SErrDisplayError(errorcode, filename, linenumber, buffer, recoverable, exitcode, 1);
|
||||
}
|
||||
|
||||
void SErrPrepareAppFatal(const char* filename, int32_t linenumber) {
|
||||
void STORMAPI SErrPrepareAppFatal(const char* filename, int32_t linenumber) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void SErrSetLastError(uint32_t errorcode) {
|
||||
void STORMAPI SErrSetLastError(uint32_t errorcode) {
|
||||
s_lasterror = errorcode;
|
||||
#if defined(WHOA_SYSTEM_WIN)
|
||||
SetLastError(errorcode);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t SErrGetLastError() {
|
||||
uint32_t STORMAPI SErrGetLastError() {
|
||||
return s_lasterror;
|
||||
}
|
||||
|
||||
void SErrSuppressErrors(uint32_t suppress) {
|
||||
void STORMAPI SErrSuppressErrors(uint32_t suppress) {
|
||||
s_suppress = suppress;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "storm/error/Macros.hpp"
|
||||
#include "storm/error/Types.hpp"
|
||||
#include <cstdint>
|
||||
#include "Core.hpp"
|
||||
|
||||
#if defined(WHOA_SYSTEM_WIN)
|
||||
#include <WinError.h>
|
||||
|
|
@ -16,18 +16,18 @@
|
|||
#define ERROR_INVALID_PARAMETER 0x57
|
||||
#endif
|
||||
|
||||
[[noreturn]] void SErrDisplayAppFatal(const char* format, ...);
|
||||
[[noreturn]] void STORMCDECL SErrDisplayAppFatal(const char* format, ...);
|
||||
|
||||
int32_t SErrDisplayError(uint32_t errorcode, const char* filename, int32_t linenumber, const char* description, int32_t recoverable, uint32_t exitcode, uint32_t a7);
|
||||
int32_t STORMAPI SErrDisplayError(uint32_t errorcode, const char* filename, int32_t linenumber, const char* description, int32_t recoverable, uint32_t exitcode, uint32_t a7);
|
||||
|
||||
int32_t SErrDisplayErrorFmt(uint32_t errorcode, const char* filename, int32_t linenumber, int32_t recoverable, uint32_t exitcode, const char* format, ...);
|
||||
int32_t STORMCDECL SErrDisplayErrorFmt(uint32_t errorcode, const char* filename, int32_t linenumber, int32_t recoverable, uint32_t exitcode, const char* format, ...);
|
||||
|
||||
void SErrPrepareAppFatal(const char* filename, int32_t linenumber);
|
||||
void STORMAPI SErrPrepareAppFatal(const char* filename, int32_t linenumber);
|
||||
|
||||
void SErrSetLastError(uint32_t errorcode);
|
||||
void STORMAPI SErrSetLastError(uint32_t errorcode);
|
||||
|
||||
uint32_t SErrGetLastError();
|
||||
uint32_t STORMAPI SErrGetLastError();
|
||||
|
||||
void SErrSuppressErrors(uint32_t suppress);
|
||||
void STORMAPI SErrSuppressErrors(uint32_t suppress);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -100,14 +100,14 @@ void CopyIdHashTable(_IDHASHTABLE *dest, _IDHASHTABLE *source) {
|
|||
}
|
||||
}
|
||||
|
||||
int32_t SEvtBreakHandlerChain(void* data) {
|
||||
int32_t STORMAPI SEvtBreakHandlerChain(void* data) {
|
||||
s_critsect.Enter();
|
||||
s_breakcmdlist.NewNode(2, 0, 0)->data = data;
|
||||
s_critsect.Leave();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t SEvtDestroy() {
|
||||
int32_t STORMAPI SEvtDestroy() {
|
||||
s_critsect.Enter();
|
||||
|
||||
for (uint32_t i = 0; i < s_typehashtablesize; i++) {
|
||||
|
|
@ -134,7 +134,7 @@ int32_t SEvtDestroy() {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int32_t SEvtDispatch(uint32_t type, uint32_t subtype, uint32_t id, void* data) {
|
||||
int32_t STORMAPI SEvtDispatch(uint32_t type, uint32_t subtype, uint32_t id, void* data) {
|
||||
SInterlockedIncrement(&s_dispatchesinprogress);
|
||||
|
||||
int32_t success = 0;
|
||||
|
|
@ -229,7 +229,7 @@ int32_t SEvtDispatch(uint32_t type, uint32_t subtype, uint32_t id, void* data) {
|
|||
return success;
|
||||
}
|
||||
|
||||
int32_t SEvtPopState(uint32_t type, uint32_t subtype) {
|
||||
int32_t STORMAPI SEvtPopState(uint32_t type, uint32_t subtype) {
|
||||
int32_t success = 0;
|
||||
s_critsect.Enter();
|
||||
|
||||
|
|
@ -259,7 +259,7 @@ int32_t SEvtPopState(uint32_t type, uint32_t subtype) {
|
|||
return success;
|
||||
}
|
||||
|
||||
int32_t SEvtPushState(uint32_t type, uint32_t subtype) {
|
||||
int32_t STORMAPI SEvtPushState(uint32_t type, uint32_t subtype) {
|
||||
int32_t success = 0;
|
||||
s_critsect.Enter();
|
||||
|
||||
|
|
@ -279,7 +279,7 @@ int32_t SEvtPushState(uint32_t type, uint32_t subtype) {
|
|||
return success;
|
||||
}
|
||||
|
||||
int32_t SEvtRegisterHandler(uint32_t type, uint32_t subtype, uint32_t id, uint32_t flags, SEVTHANDLER handler) {
|
||||
int32_t STORMAPI SEvtRegisterHandler(uint32_t type, uint32_t subtype, uint32_t id, uint32_t flags, SEVTHANDLER handler) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(handler);
|
||||
STORM_VALIDATE(!flags);
|
||||
|
|
@ -375,7 +375,7 @@ int32_t SEvtRegisterHandler(uint32_t type, uint32_t subtype, uint32_t id, uint32
|
|||
return 1;
|
||||
}
|
||||
|
||||
int32_t SEvtUnregisterHandler(uint32_t type, uint32_t subtype, uint32_t id, SEVTHANDLER handler) {
|
||||
int32_t STORMAPI SEvtUnregisterHandler(uint32_t type, uint32_t subtype, uint32_t id, SEVTHANDLER handler) {
|
||||
int32_t success = 0;
|
||||
s_critsect.Enter();
|
||||
|
||||
|
|
@ -404,7 +404,7 @@ int32_t SEvtUnregisterHandler(uint32_t type, uint32_t subtype, uint32_t id, SEVT
|
|||
return success;
|
||||
}
|
||||
|
||||
int32_t SEvtUnregisterType(uint32_t type, uint32_t subtype) {
|
||||
int32_t STORMAPI SEvtUnregisterType(uint32_t type, uint32_t subtype) {
|
||||
int32_t success = 0;
|
||||
s_critsect.Enter();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,33 +2,27 @@
|
|||
#define STORM_EVENT_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include "Core.hpp"
|
||||
|
||||
#ifndef STORMAPI
|
||||
#if defined(_MSC_VER)
|
||||
#define STORMAPI __stdcall
|
||||
#else
|
||||
#define STORMAPI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef void (STORMAPI* SEVTHANDLER)(void*);
|
||||
|
||||
|
||||
int32_t SEvtBreakHandlerChain(void* data);
|
||||
int32_t STORMAPI SEvtBreakHandlerChain(void* data);
|
||||
|
||||
int32_t SEvtDestroy();
|
||||
int32_t STORMAPI SEvtDestroy();
|
||||
|
||||
int32_t SEvtDispatch(uint32_t type, uint32_t subtype, uint32_t id, void* data);
|
||||
int32_t STORMAPI SEvtDispatch(uint32_t type, uint32_t subtype, uint32_t id, void* data);
|
||||
|
||||
int32_t SEvtPopState(uint32_t type, uint32_t subtype);
|
||||
int32_t STORMAPI SEvtPopState(uint32_t type, uint32_t subtype);
|
||||
|
||||
int32_t SEvtPushState(uint32_t type, uint32_t subtype);
|
||||
int32_t STORMAPI SEvtPushState(uint32_t type, uint32_t subtype);
|
||||
|
||||
int32_t SEvtRegisterHandler(uint32_t type, uint32_t subtype, uint32_t id, uint32_t flags, SEVTHANDLER handler);
|
||||
int32_t STORMAPI SEvtRegisterHandler(uint32_t type, uint32_t subtype, uint32_t id, uint32_t flags, SEVTHANDLER handler);
|
||||
|
||||
int32_t SEvtUnregisterHandler(uint32_t type, uint32_t subtype, uint32_t id, SEVTHANDLER handler);
|
||||
int32_t STORMAPI SEvtUnregisterHandler(uint32_t type, uint32_t subtype, uint32_t id, SEVTHANDLER handler);
|
||||
|
||||
int32_t SEvtUnregisterType(uint32_t type, uint32_t subtype);
|
||||
int32_t STORMAPI SEvtUnregisterType(uint32_t type, uint32_t subtype);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ void operator delete[](void* ptr) noexcept {
|
|||
}
|
||||
}
|
||||
|
||||
void* SMemAlloc(size_t bytes, const char* filename, int32_t linenumber, uint32_t flags) {
|
||||
void* STORMAPI SMemAlloc(size_t bytes, const char* filename, int32_t linenumber, uint32_t flags) {
|
||||
size_t alignedBytes = (bytes + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1);
|
||||
|
||||
void* result;
|
||||
|
|
@ -43,31 +43,31 @@ void* SMemAlloc(size_t bytes, const char* filename, int32_t linenumber, uint32_t
|
|||
}
|
||||
}
|
||||
|
||||
void SMemCopy(void* dst, void* src, size_t bytes) {
|
||||
void STORMAPI SMemCopy(void* dst, void* src, size_t bytes) {
|
||||
memmove(dst, src, bytes);
|
||||
}
|
||||
|
||||
void SMemFill(void* ptr, size_t bytes, uint8_t value) {
|
||||
void STORMAPI SMemFill(void* ptr, size_t bytes, uint8_t value) {
|
||||
memset(ptr, value, bytes);
|
||||
}
|
||||
|
||||
void SMemFree(void* ptr) {
|
||||
void STORMAPI SMemFree(void* ptr) {
|
||||
if (ptr) {
|
||||
free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void SMemFree(void* ptr, const char* filename, int32_t linenumber, uint32_t flags) {
|
||||
void STORMAPI SMemFree(void* ptr, const char* filename, int32_t linenumber, uint32_t flags) {
|
||||
if (ptr) {
|
||||
free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void SMemMove(void* dst, void* src, size_t bytes) {
|
||||
void STORMAPI SMemMove(void* dst, void* src, size_t bytes) {
|
||||
memmove(dst, src, bytes);
|
||||
}
|
||||
|
||||
void* SMemReAlloc(void* ptr, size_t bytes, const char* filename, int32_t linenumber, uint32_t flags) {
|
||||
void* STORMAPI SMemReAlloc(void* ptr, size_t bytes, const char* filename, int32_t linenumber, uint32_t flags) {
|
||||
if (flags == 0xB00BEEE5) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ void* SMemReAlloc(void* ptr, size_t bytes, const char* filename, int32_t linenum
|
|||
}
|
||||
}
|
||||
|
||||
void SMemZero(void* ptr, size_t bytes) {
|
||||
void STORMAPI SMemZero(void* ptr, size_t bytes) {
|
||||
uint8_t* ptrdata = static_cast<uint8_t*>(ptr);
|
||||
for (size_t i = 0; i < bytes; i++) {
|
||||
ptrdata[i] = 0;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
#include "Core.hpp"
|
||||
|
||||
#define SMEM_FLAG_ZEROMEMORY 0x8
|
||||
|
||||
|
|
@ -22,20 +23,20 @@
|
|||
#define STORM_NEW_ZERO(t) \
|
||||
new(SMemAlloc(sizeof(t), __FILE__, __LINE__, SMEM_FLAG_ZEROMEMORY)) t
|
||||
|
||||
void* SMemAlloc(size_t bytes, const char* filename, int32_t linenumber, uint32_t flags = 0);
|
||||
void* STORMAPI SMemAlloc(size_t bytes, const char* filename, int32_t linenumber, uint32_t flags = 0);
|
||||
|
||||
void SMemCopy(void* dst, void* src, size_t bytes);
|
||||
void STORMAPI SMemCopy(void* dst, void* src, size_t bytes);
|
||||
|
||||
void SMemFill(void* ptr, size_t bytes, uint8_t value);
|
||||
void STORMAPI SMemFill(void* ptr, size_t bytes, uint8_t value);
|
||||
|
||||
void SMemFree(void* ptr);
|
||||
void STORMAPI SMemFree(void* ptr);
|
||||
|
||||
void SMemFree(void* ptr, const char* filename, int32_t linenumber, uint32_t flags = 0);
|
||||
void STORMAPI SMemFree(void* ptr, const char* filename, int32_t linenumber, uint32_t flags = 0);
|
||||
|
||||
void SMemMove(void* dst, void* src, size_t bytes);
|
||||
void STORMAPI SMemMove(void* dst, void* src, size_t bytes);
|
||||
|
||||
void* SMemReAlloc(void* ptr, size_t bytes, const char* filename, int32_t linenumber, uint32_t flags = 0);
|
||||
void* STORMAPI SMemReAlloc(void* ptr, size_t bytes, const char* filename, int32_t linenumber, uint32_t flags = 0);
|
||||
|
||||
void SMemZero(void* ptr, size_t bytes);
|
||||
void STORMAPI SMemZero(void* ptr, size_t bytes);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "storm/Error.hpp"
|
||||
#include "storm/Hash.hpp"
|
||||
#include "storm/Thread.hpp"
|
||||
|
||||
#include <limits>
|
||||
|
||||
static TSExportTableSyncReuse<RGN, HSRGN, HLOCKEDRGN, CCritSect> s_rgntable;
|
||||
|
|
@ -489,7 +490,7 @@ void ProduceCombinedRectangles(RGN* rgn) {
|
|||
}
|
||||
}
|
||||
|
||||
void SRgnCombineRectf(HSRGN handle, const RECTF* rect, void* param, int32_t combineMode) {
|
||||
void STORMAPI SRgnCombineRectf(HSRGN handle, const RECTF* rect, void* param, int32_t combineMode) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(handle);
|
||||
STORM_VALIDATE(rect);
|
||||
|
|
@ -522,7 +523,7 @@ void SRgnCombineRectf(HSRGN handle, const RECTF* rect, void* param, int32_t comb
|
|||
s_rgntable.Unlock(lockedHandle);
|
||||
}
|
||||
|
||||
void SRgnCombineRecti(HSRGN handle, const RECT* rect, void* param, int32_t combineMode) {
|
||||
void STORMAPI SRgnCombineRecti(HSRGN handle, const RECT* rect, void* param, int32_t combineMode) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(rect);
|
||||
STORM_VALIDATE_END_VOID;
|
||||
|
|
@ -537,7 +538,7 @@ void SRgnCombineRecti(HSRGN handle, const RECT* rect, void* param, int32_t combi
|
|||
SRgnCombineRectf(handle, &rectf, param, combineMode);
|
||||
}
|
||||
|
||||
void SRgnClear(HSRGN handle) {
|
||||
void STORMAPI SRgnClear(HSRGN handle) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(handle);
|
||||
STORM_VALIDATE_END_VOID;
|
||||
|
|
@ -551,7 +552,7 @@ void SRgnClear(HSRGN handle) {
|
|||
}
|
||||
}
|
||||
|
||||
void SRgnCreate(HSRGN* handlePtr, uint32_t reserved) {
|
||||
void STORMAPI SRgnCreate(HSRGN* handlePtr, uint32_t reserved) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(handlePtr);
|
||||
STORM_VALIDATE(!reserved);
|
||||
|
|
@ -565,7 +566,7 @@ void SRgnCreate(HSRGN* handlePtr, uint32_t reserved) {
|
|||
s_rgntable.Unlock(lockedHandle);
|
||||
}
|
||||
|
||||
void SRgnDelete(HSRGN handle) {
|
||||
void STORMAPI SRgnDelete(HSRGN handle) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(handle);
|
||||
STORM_VALIDATE_END_VOID;
|
||||
|
|
@ -573,7 +574,7 @@ void SRgnDelete(HSRGN handle) {
|
|||
s_rgntable.Delete(handle);
|
||||
}
|
||||
|
||||
void SRgnDuplicate(HSRGN origHandle, HSRGN* handle, uint32_t reserved) {
|
||||
void STORMAPI SRgnDuplicate(HSRGN origHandle, HSRGN* handle, uint32_t reserved) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(handle);
|
||||
*handle = nullptr;
|
||||
|
|
@ -603,7 +604,7 @@ void SRgnDuplicate(HSRGN origHandle, HSRGN* handle, uint32_t reserved) {
|
|||
s_rgntable.Unlock(origlockedhandle);
|
||||
}
|
||||
|
||||
void SRgnGetBoundingRectf(HSRGN handle, RECTF* rect) {
|
||||
void STORMAPI SRgnGetBoundingRectf(HSRGN handle, RECTF* rect) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(handle);
|
||||
STORM_VALIDATE(rect);
|
||||
|
|
@ -649,7 +650,7 @@ void SRgnGetBoundingRectf(HSRGN handle, RECTF* rect) {
|
|||
}
|
||||
}
|
||||
|
||||
void SRgnGetBoundingRecti(HSRGN handle, RECT* rect) {
|
||||
void STORMAPI SRgnGetBoundingRecti(HSRGN handle, RECT* rect) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(rect);
|
||||
STORM_VALIDATE_END_VOID;
|
||||
|
|
@ -669,7 +670,7 @@ void SRgnGetBoundingRecti(HSRGN handle, RECT* rect) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void SRgnGetRectParamsf(HSRGN handle, const RECTF* rect, uint32_t* numParams, void** buffer) {
|
||||
void STORMAPI SRgnGetRectParamsf(HSRGN handle, const RECTF* rect, uint32_t* numParams, void** buffer) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(handle);
|
||||
STORM_VALIDATE(rect);
|
||||
|
|
@ -710,7 +711,7 @@ void SRgnGetRectParamsf(HSRGN handle, const RECTF* rect, uint32_t* numParams, vo
|
|||
s_rgntable.Unlock(lockedHandle);
|
||||
}
|
||||
|
||||
void SRgnGetRectParamsi(HSRGN handle, const RECT* rect, uint32_t* numParams, void** buffer) {
|
||||
void STORMAPI SRgnGetRectParamsi(HSRGN handle, const RECT* rect, uint32_t* numParams, void** buffer) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(rect);
|
||||
STORM_VALIDATE_END_VOID;
|
||||
|
|
@ -725,7 +726,7 @@ void SRgnGetRectParamsi(HSRGN handle, const RECT* rect, uint32_t* numParams, voi
|
|||
SRgnGetRectParamsf(handle, &rectf, numParams, buffer);
|
||||
}
|
||||
|
||||
void SRgnGetRectsf(HSRGN handle, uint32_t* numRects, RECTF* buffer) {
|
||||
void STORMAPI SRgnGetRectsf(HSRGN handle, uint32_t* numRects, RECTF* buffer) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(handle);
|
||||
STORM_VALIDATE(numRects);
|
||||
|
|
@ -754,7 +755,7 @@ void SRgnGetRectsf(HSRGN handle, uint32_t* numRects, RECTF* buffer) {
|
|||
s_rgntable.Unlock(lockedHandle);
|
||||
}
|
||||
|
||||
void SRgnGetRectsi(HSRGN handle, uint32_t* numRects, RECT* buffer) {
|
||||
void STORMAPI SRgnGetRectsi(HSRGN handle, uint32_t* numRects, RECT* buffer) {
|
||||
RECTF* bufferf = reinterpret_cast<RECTF*>(buffer);
|
||||
SRgnGetRectsf(handle, numRects, bufferf);
|
||||
if (buffer) {
|
||||
|
|
@ -775,7 +776,7 @@ void SRgnGetRectsi(HSRGN handle, uint32_t* numRects, RECT* buffer) {
|
|||
}
|
||||
}
|
||||
|
||||
int32_t SRgnIsPointInRegionf(HSRGN handle, float x, float y) {
|
||||
int32_t STORMAPI SRgnIsPointInRegionf(HSRGN handle, float x, float y) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(handle);
|
||||
STORM_VALIDATE_END;
|
||||
|
|
@ -809,11 +810,11 @@ int32_t SRgnIsPointInRegionf(HSRGN handle, float x, float y) {
|
|||
return result;
|
||||
}
|
||||
|
||||
int32_t SRgnIsPointInRegioni(HSRGN handle, int32_t x, int32_t y) {
|
||||
int32_t STORMAPI SRgnIsPointInRegioni(HSRGN handle, int32_t x, int32_t y) {
|
||||
return SRgnIsPointInRegionf(handle, static_cast<float>(x), static_cast<float>(y));
|
||||
}
|
||||
|
||||
int32_t SRgnIsRectInRegionf(HSRGN handle, const RECTF* rect) {
|
||||
int32_t STORMAPI SRgnIsRectInRegionf(HSRGN handle, const RECTF* rect) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(handle);
|
||||
STORM_VALIDATE(rect);
|
||||
|
|
@ -842,7 +843,7 @@ int32_t SRgnIsRectInRegionf(HSRGN handle, const RECTF* rect) {
|
|||
return result;
|
||||
}
|
||||
|
||||
int32_t SRgnIsRectInRegioni(HSRGN handle, const RECT* rect) {
|
||||
int32_t STORMAPI SRgnIsRectInRegioni(HSRGN handle, const RECT* rect) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(rect);
|
||||
STORM_VALIDATE_END;
|
||||
|
|
@ -857,7 +858,7 @@ int32_t SRgnIsRectInRegioni(HSRGN handle, const RECT* rect) {
|
|||
return SRgnIsRectInRegionf(handle, &rectf);
|
||||
}
|
||||
|
||||
void SRgnOffsetf(HSRGN handle, float xoffset, float yoffset) {
|
||||
void STORMAPI SRgnOffsetf(HSRGN handle, float xoffset, float yoffset) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(handle);
|
||||
STORM_VALIDATE_END_VOID;
|
||||
|
|
@ -881,6 +882,6 @@ void SRgnOffsetf(HSRGN handle, float xoffset, float yoffset) {
|
|||
s_rgntable.Unlock(lockedHandle);
|
||||
}
|
||||
|
||||
void SRgnOffseti(HSRGN handle, int32_t xoffset, int32_t yoffset) {
|
||||
void STORMAPI SRgnOffseti(HSRGN handle, int32_t xoffset, int32_t yoffset) {
|
||||
SRgnOffsetf(handle, static_cast<float>(xoffset), static_cast<float>(yoffset));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,42 +2,42 @@
|
|||
#define STORM_REGION_HPP
|
||||
|
||||
#include "storm/region/Types.hpp"
|
||||
#include <cstdint>
|
||||
#include "Core.hpp"
|
||||
|
||||
void SRgnClear(HSRGN handle);
|
||||
void STORMAPI SRgnClear(HSRGN handle);
|
||||
|
||||
void SRgnCombineRectf(HSRGN handle, const RECTF* rect, void* param, int32_t combineMode);
|
||||
void STORMAPI SRgnCombineRectf(HSRGN handle, const RECTF* rect, void* param, int32_t combineMode);
|
||||
|
||||
void SRgnCombineRecti(HSRGN handle, const RECT* rect, void* param, int32_t combineMode);
|
||||
void STORMAPI SRgnCombineRecti(HSRGN handle, const RECT* rect, void* param, int32_t combineMode);
|
||||
|
||||
void SRgnCreate(HSRGN* handlePtr, uint32_t reserved = 0);
|
||||
void STORMAPI SRgnCreate(HSRGN* handlePtr, uint32_t reserved = 0);
|
||||
|
||||
void SRgnDelete(HSRGN handle);
|
||||
void STORMAPI SRgnDelete(HSRGN handle);
|
||||
|
||||
void SRgnDuplicate(HSRGN origHandle, HSRGN* handle, uint32_t reserved = 0);
|
||||
void STORMAPI SRgnDuplicate(HSRGN origHandle, HSRGN* handle, uint32_t reserved = 0);
|
||||
|
||||
void SRgnGetBoundingRectf(HSRGN handle, RECTF* rect);
|
||||
void STORMAPI SRgnGetBoundingRectf(HSRGN handle, RECTF* rect);
|
||||
|
||||
void SRgnGetBoundingRecti(HSRGN handle, RECT* rect);
|
||||
void STORMAPI SRgnGetBoundingRecti(HSRGN handle, RECT* rect);
|
||||
|
||||
void SRgnGetRectParamsf(HSRGN handle, const RECTF* rect, uint32_t* numParams, void** buffer);
|
||||
void STORMAPI SRgnGetRectParamsf(HSRGN handle, const RECTF* rect, uint32_t* numParams, void** buffer);
|
||||
|
||||
void SRgnGetRectParamsi(HSRGN handle, const RECT* rect, uint32_t* numParams, void** buffer);
|
||||
void STORMAPI SRgnGetRectParamsi(HSRGN handle, const RECT* rect, uint32_t* numParams, void** buffer);
|
||||
|
||||
void SRgnGetRectsf(HSRGN handle, uint32_t* numRects, RECTF* buffer);
|
||||
void STORMAPI SRgnGetRectsf(HSRGN handle, uint32_t* numRects, RECTF* buffer);
|
||||
|
||||
void SRgnGetRectsi(HSRGN handle, uint32_t* numRects, RECT* buffer);
|
||||
void STORMAPI SRgnGetRectsi(HSRGN handle, uint32_t* numRects, RECT* buffer);
|
||||
|
||||
int32_t SRgnIsPointInRegionf(HSRGN handle, float x, float y);
|
||||
int32_t STORMAPI SRgnIsPointInRegionf(HSRGN handle, float x, float y);
|
||||
|
||||
int32_t SRgnIsPointInRegioni(HSRGN handle, int32_t x, int32_t y);
|
||||
int32_t STORMAPI SRgnIsPointInRegioni(HSRGN handle, int32_t x, int32_t y);
|
||||
|
||||
int32_t SRgnIsRectInRegionf(HSRGN handle, const RECTF* rect);
|
||||
int32_t STORMAPI SRgnIsRectInRegionf(HSRGN handle, const RECTF* rect);
|
||||
|
||||
int32_t SRgnIsRectInRegioni(HSRGN handle, const RECT* rect);
|
||||
int32_t STORMAPI SRgnIsRectInRegioni(HSRGN handle, const RECT* rect);
|
||||
|
||||
void SRgnOffsetf(HSRGN handle, float xoffset, float yoffset);
|
||||
void STORMAPI SRgnOffsetf(HSRGN handle, float xoffset, float yoffset);
|
||||
|
||||
void SRgnOffseti(HSRGN handle, int32_t xoffset, int32_t yoffset);
|
||||
void STORMAPI SRgnOffseti(HSRGN handle, int32_t xoffset, int32_t yoffset);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -206,14 +206,14 @@ size_t ISStrVPrintf(char* dest, size_t maxchars, const char* format, va_list va)
|
|||
return result;
|
||||
}
|
||||
|
||||
void SStrInitialize() {
|
||||
void STORMAPI SStrInitialize() {
|
||||
if (!s_initialized) {
|
||||
InitializeFloatDigits();
|
||||
s_initialized = 1;
|
||||
}
|
||||
}
|
||||
|
||||
char* SStrChr(char* string, char search) {
|
||||
char* STORMAPI SStrChr(char* string, char search) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE_END;
|
||||
|
|
@ -233,7 +233,7 @@ char* SStrChr(char* string, char search) {
|
|||
return string;
|
||||
}
|
||||
|
||||
const char* SStrChr(const char* string, char search) {
|
||||
const char* STORMAPI SStrChr(const char* string, char search) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE_END;
|
||||
|
|
@ -253,7 +253,7 @@ const char* SStrChr(const char* string, char search) {
|
|||
return string;
|
||||
}
|
||||
|
||||
char* SStrChrR(char* string, char search) {
|
||||
char* STORMAPI SStrChrR(char* string, char search) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE_END;
|
||||
|
|
@ -269,7 +269,7 @@ char* SStrChrR(char* string, char search) {
|
|||
return result;
|
||||
}
|
||||
|
||||
const char* SStrChrR(const char* string, char search) {
|
||||
const char* STORMAPI SStrChrR(const char* string, char search) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE_END;
|
||||
|
|
@ -285,7 +285,7 @@ const char* SStrChrR(const char* string, char search) {
|
|||
return result;
|
||||
}
|
||||
|
||||
int32_t SStrCmp(const char* string1, const char* string2, size_t maxchars) {
|
||||
int32_t STORMAPI SStrCmp(const char* string1, const char* string2, size_t maxchars) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string1);
|
||||
STORM_VALIDATE(string2);
|
||||
|
|
@ -294,7 +294,7 @@ int32_t SStrCmp(const char* string1, const char* string2, size_t maxchars) {
|
|||
return strncmp(string1, string2, maxchars);
|
||||
}
|
||||
|
||||
int32_t SStrCmpI(const char* string1, const char* string2, size_t maxchars) {
|
||||
int32_t STORMAPI SStrCmpI(const char* string1, const char* string2, size_t maxchars) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string1);
|
||||
STORM_VALIDATE(string2);
|
||||
|
|
@ -309,7 +309,7 @@ int32_t SStrCmpI(const char* string1, const char* string2, size_t maxchars) {
|
|||
#endif
|
||||
}
|
||||
|
||||
size_t SStrCopy(char* dest, const char* source, size_t destsize) {
|
||||
size_t STORMAPI SStrCopy(char* dest, const char* source, size_t destsize) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(dest);
|
||||
STORM_VALIDATE(source);
|
||||
|
|
@ -344,7 +344,7 @@ size_t SStrCopy(char* dest, const char* source, size_t destsize) {
|
|||
return static_cast<size_t>(destbuf - dest);
|
||||
}
|
||||
|
||||
char* SStrDupA(const char* string, const char* filename, uint32_t linenumber) {
|
||||
char* STORMAPI SStrDupA(const char* string, const char* filename, uint32_t linenumber) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE_END;
|
||||
|
|
@ -356,7 +356,7 @@ char* SStrDupA(const char* string, const char* filename, uint32_t linenumber) {
|
|||
return dup;
|
||||
}
|
||||
|
||||
uint32_t SStrHash(const char* string, uint32_t flags, uint32_t seed) {
|
||||
uint32_t STORMAPI SStrHash(const char* string, uint32_t flags, uint32_t seed) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE_END;
|
||||
|
|
@ -392,7 +392,7 @@ uint32_t SStrHash(const char* string, uint32_t flags, uint32_t seed) {
|
|||
return result ? result : 1;
|
||||
}
|
||||
|
||||
uint32_t SStrHashHT(const char* string) {
|
||||
uint32_t STORMAPI SStrHashHT(const char* string) {
|
||||
char normalized[0x400];
|
||||
char* buf = normalized;
|
||||
|
||||
|
|
@ -423,7 +423,7 @@ uint32_t SStrHashHT(const char* string) {
|
|||
return bjhash((uint8_t*)&normalized, length, 0);
|
||||
}
|
||||
|
||||
size_t SStrLen(const char* string) {
|
||||
size_t STORMAPI SStrLen(const char* string) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE_END;
|
||||
|
|
@ -436,14 +436,14 @@ size_t SStrLen(const char* string) {
|
|||
return stringEnd - string;
|
||||
}
|
||||
|
||||
void SStrLower(char* string) {
|
||||
void STORMAPI SStrLower(char* string) {
|
||||
while (*string) {
|
||||
*string = static_cast<char>(tolower(*string));
|
||||
string++;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t SStrPack(char* dest, const char* source, uint32_t destsize) {
|
||||
uint32_t STORMAPI SStrPack(char* dest, const char* source, uint32_t destsize) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(dest);
|
||||
STORM_VALIDATE(source);
|
||||
|
|
@ -488,7 +488,7 @@ uint32_t SStrPack(char* dest, const char* source, uint32_t destsize) {
|
|||
return static_cast<uint32_t>(i - dest);
|
||||
}
|
||||
|
||||
size_t SStrPrintf(char* dest, size_t maxchars, const char* format, ...) {
|
||||
size_t STORMCDECL SStrPrintf(char* dest, size_t maxchars, const char* format, ...) {
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
|
||||
|
|
@ -500,7 +500,7 @@ size_t SStrPrintf(char* dest, size_t maxchars, const char* format, ...) {
|
|||
return ISStrVPrintf(dest, maxchars, format, va);
|
||||
}
|
||||
|
||||
size_t SStrVPrintf(char* dest, size_t maxchars, const char* format, va_list arglist) {
|
||||
size_t STORMAPI SStrVPrintf(char* dest, size_t maxchars, const char* format, va_list arglist) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(dest);
|
||||
STORM_VALIDATE(format);
|
||||
|
|
@ -509,7 +509,7 @@ size_t SStrVPrintf(char* dest, size_t maxchars, const char* format, va_list argl
|
|||
return ISStrVPrintf(dest, maxchars, format, arglist);
|
||||
}
|
||||
|
||||
char* SStrStr(char* string, const char* search) {
|
||||
char* STORMAPI SStrStr(char* string, const char* search) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE(search);
|
||||
|
|
@ -525,7 +525,7 @@ char* SStrStr(char* string, const char* search) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const char* SStrStr(const char* string, const char* search) {
|
||||
const char* STORMAPI SStrStr(const char* string, const char* search) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE(search);
|
||||
|
|
@ -541,7 +541,7 @@ const char* SStrStr(const char* string, const char* search) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
char* SStrStrI(char* string, const char* search) {
|
||||
char* STORMAPI SStrStrI(char* string, const char* search) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE(search);
|
||||
|
|
@ -557,7 +557,7 @@ char* SStrStrI(char* string, const char* search) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const char* SStrStrI(const char* string, const char* search) {
|
||||
const char* STORMAPI SStrStrI(const char* string, const char* search) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE(search);
|
||||
|
|
@ -573,7 +573,7 @@ const char* SStrStrI(const char* string, const char* search) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void SStrTokenize(const char** string, char* buffer, size_t bufferchars, const char* whitespace, int32_t* quoted) {
|
||||
void STORMAPI SStrTokenize(const char** string, char* buffer, size_t bufferchars, const char* whitespace, int32_t* quoted) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE(*string);
|
||||
|
|
@ -735,7 +735,7 @@ static inline double ISStrToDouble(const char* string) {
|
|||
return result;
|
||||
}
|
||||
|
||||
double SStrToDouble(const char* string) {
|
||||
double STORMAPI SStrToDouble(const char* string) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE_END;
|
||||
|
|
@ -743,7 +743,7 @@ double SStrToDouble(const char* string) {
|
|||
return ISStrToDouble(string);
|
||||
}
|
||||
|
||||
float SStrToFloat(const char* string) {
|
||||
float STORMAPI SStrToFloat(const char* string) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE_END;
|
||||
|
|
@ -751,7 +751,7 @@ float SStrToFloat(const char* string) {
|
|||
return static_cast<float>(ISStrToDouble(string));
|
||||
}
|
||||
|
||||
int32_t SStrToInt(const char* string) {
|
||||
int32_t STORMAPI SStrToInt(const char* string) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE_END;
|
||||
|
|
@ -777,7 +777,7 @@ int32_t SStrToInt(const char* string) {
|
|||
return result;
|
||||
}
|
||||
|
||||
uint32_t SStrToUnsigned(const char* string) {
|
||||
uint32_t STORMAPI SStrToUnsigned(const char* string) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE_END;
|
||||
|
|
@ -793,7 +793,7 @@ uint32_t SStrToUnsigned(const char* string) {
|
|||
return result;
|
||||
}
|
||||
|
||||
void SStrUpper(char* string) {
|
||||
void STORMAPI SStrUpper(char* string) {
|
||||
while (*string) {
|
||||
*string = static_cast<char>(toupper(*string));
|
||||
string++;
|
||||
|
|
|
|||
|
|
@ -2,62 +2,62 @@
|
|||
#define STORM_STRING_HPP
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include "Core.hpp"
|
||||
|
||||
#define STORM_MAX_PATH 260
|
||||
#define STORM_MAX_STR 0x7FFFFFFF
|
||||
|
||||
#define SSTR_HASH_CASESENSITIVE 1
|
||||
|
||||
char* SStrChr(char* string, char search);
|
||||
char* STORMAPI SStrChr(char* string, char search);
|
||||
|
||||
const char* SStrChr(const char* string, char search);
|
||||
const char* STORMAPI SStrChr(const char* string, char search);
|
||||
|
||||
char* SStrChrR(char* string, char search);
|
||||
char* STORMAPI SStrChrR(char* string, char search);
|
||||
|
||||
const char* SStrChrR(const char* string, char search);
|
||||
const char* STORMAPI SStrChrR(const char* string, char search);
|
||||
|
||||
int32_t SStrCmp(const char* string1, const char* string2, size_t maxchars = STORM_MAX_STR);
|
||||
int32_t STORMAPI SStrCmp(const char* string1, const char* string2, size_t maxchars = STORM_MAX_STR);
|
||||
|
||||
int32_t SStrCmpI(const char* string1, const char* string2, size_t maxchars = STORM_MAX_STR);
|
||||
int32_t STORMAPI SStrCmpI(const char* string1, const char* string2, size_t maxchars = STORM_MAX_STR);
|
||||
|
||||
size_t SStrCopy(char* dest, const char* source, size_t destsize = STORM_MAX_STR);
|
||||
size_t STORMAPI SStrCopy(char* dest, const char* source, size_t destsize = STORM_MAX_STR);
|
||||
|
||||
char* SStrDupA(const char* string, const char* filename, uint32_t linenumber);
|
||||
char* STORMAPI SStrDupA(const char* string, const char* filename, uint32_t linenumber);
|
||||
|
||||
uint32_t SStrHash(const char* string, uint32_t flags = 0, uint32_t seed = 0);
|
||||
uint32_t STORMAPI SStrHash(const char* string, uint32_t flags = 0, uint32_t seed = 0);
|
||||
|
||||
uint32_t SStrHashHT(const char* string);
|
||||
uint32_t STORMAPI SStrHashHT(const char* string);
|
||||
|
||||
size_t SStrLen(const char* string);
|
||||
size_t STORMAPI SStrLen(const char* string);
|
||||
|
||||
void SStrLower(char* string);
|
||||
void STORMAPI SStrLower(char* string);
|
||||
|
||||
uint32_t SStrPack(char* dest, const char* source, uint32_t destsize);
|
||||
uint32_t STORMAPI SStrPack(char* dest, const char* source, uint32_t destsize);
|
||||
|
||||
size_t SStrPrintf(char* dest, size_t maxchars, const char* format, ...);
|
||||
size_t STORMCDECL SStrPrintf(char* dest, size_t maxchars, const char* format, ...);
|
||||
|
||||
size_t SStrVPrintf(char* dest, size_t maxchars, const char* format, va_list arglist);
|
||||
size_t STORMAPI SStrVPrintf(char* dest, size_t maxchars, const char* format, va_list arglist);
|
||||
|
||||
char* SStrStr(char* string, const char* search);
|
||||
char* STORMAPI SStrStr(char* string, const char* search);
|
||||
|
||||
const char* SStrStr(const char* string, const char* search);
|
||||
const char* STORMAPI SStrStr(const char* string, const char* search);
|
||||
|
||||
char* SStrStrI(char* string, const char* search);
|
||||
char* STORMAPI SStrStrI(char* string, const char* search);
|
||||
|
||||
const char* SStrStrI(const char* string, const char* search);
|
||||
const char* STORMAPI SStrStrI(const char* string, const char* search);
|
||||
|
||||
void SStrTokenize(const char** string, char* buffer, size_t bufferchars, const char* whitespace, int32_t* quoted);
|
||||
void STORMAPI SStrTokenize(const char** string, char* buffer, size_t bufferchars, const char* whitespace, int32_t* quoted);
|
||||
|
||||
double SStrToDouble(const char* string);
|
||||
double STORMAPI SStrToDouble(const char* string);
|
||||
|
||||
float SStrToFloat(const char* string);
|
||||
float STORMAPI SStrToFloat(const char* string);
|
||||
|
||||
int32_t SStrToInt(const char* string);
|
||||
int32_t STORMAPI SStrToInt(const char* string);
|
||||
|
||||
uint32_t SStrToUnsigned(const char* string);
|
||||
uint32_t STORMAPI SStrToUnsigned(const char* string);
|
||||
|
||||
void SStrUpper(char* string);
|
||||
void STORMAPI SStrUpper(char* string);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "storm/Unicode.hpp"
|
||||
|
||||
uint32_t SUniSGetUTF8(const uint8_t* strptr, int32_t* chars) {
|
||||
uint32_t STORMAPI SUniSGetUTF8(const uint8_t* strptr, int32_t* chars) {
|
||||
if (chars) {
|
||||
*chars = 0;
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ uint32_t SUniSGetUTF8(const uint8_t* strptr, int32_t* chars) {
|
|||
return value;
|
||||
}
|
||||
|
||||
void SUniSPutUTF8(uint32_t c, char* strptr) {
|
||||
void STORMAPI SUniSPutUTF8(uint32_t c, char* strptr) {
|
||||
if (!strptr) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef STORM_UNICODE_HPP
|
||||
#define STORM_UNICODE_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include "Core.hpp"
|
||||
|
||||
uint32_t SUniSGetUTF8(const uint8_t* strptr, int32_t* chars);
|
||||
uint32_t STORMAPI SUniSGetUTF8(const uint8_t* strptr, int32_t* chars);
|
||||
|
||||
void SUniSPutUTF8(uint32_t c, char* strptr);
|
||||
void STORMAPI SUniSPutUTF8(uint32_t c, char* strptr);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue