mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-10 04:31:34 -10:00
This allows to mark certain functions or virtvars to be declared as "deprecated" starting with a specific engine version. What this means is that a special message will be added to the documentation stating since when the function is deprecated and can contain an optional message. The actual enforcement of the deprecation depends on the target version of the mod so that we can stay backwards compatible. If the mod supports the version since when the function is deprecated, it will not be added to the Lua state which means that it doesn't exist for the calling script. If the targetted version is before the stated version, the function will still be added to the Lua state. As the first function to use this feature, I have deprecated createParticle in the testing library and moved it to the graphics library with a new name reflecting that it creates a persistent particle. I also added the corresponding function for adding a non-persistent particle.
82 lines
1.5 KiB
C++
82 lines
1.5 KiB
C++
//
|
|
//
|
|
|
|
#ifndef FS2_OPEN_CASECMP_H
|
|
#define FS2_OPEN_CASECMP_H
|
|
|
|
#include "platformChecks.h"
|
|
|
|
#include <utility>
|
|
|
|
#if SCP_HAVE_STRCASECMP || SCP_HAVE_STRNCASECMP
|
|
#if SCP_HAVE_STRINGS_H
|
|
#include <strings.h>
|
|
#else
|
|
#error strings.h is not available!
|
|
#endif
|
|
#endif
|
|
|
|
#if SCP_HAVE__STRICMP || SCP_HAVE__STRNICMP || SCP_HAVE_STRLWR
|
|
#include <string.h>
|
|
#endif
|
|
|
|
#if SCP_HAVE_STRCASECMP
|
|
inline int stricmp(const char* s1, const char* s2) {
|
|
return strcasecmp(s1, s2);
|
|
}
|
|
#elif SCP_HAVE__STRICMP
|
|
inline int stricmp(const char* s1, const char* s2) {
|
|
return _stricmp(s1, s2);
|
|
}
|
|
#else
|
|
#error No case insensitive string comparision available!
|
|
#endif
|
|
|
|
#if SCP_HAVE_STRNCASECMP
|
|
inline int strnicmp(const char* s1, const char* s2, size_t n) {
|
|
return strncasecmp(s1, s2, n);
|
|
}
|
|
#elif SCP_HAVE__STRNICMP
|
|
inline int strnicmp(const char* s1, const char* s2, size_t n) {
|
|
return _strnicmp(s1, s2, n);
|
|
}
|
|
#else
|
|
#error No case insensitive string comparision available!
|
|
#endif
|
|
|
|
#if !SCP_HAVE_STRLWR
|
|
inline void strlwr(char *s) {
|
|
if (s == NULL)
|
|
return;
|
|
|
|
while (*s) {
|
|
*s = (char) tolower(*s);
|
|
s++;
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#if !SCP_HAVE_SNPRINTF
|
|
#if SCP_HAVE__SNPRINTF
|
|
#define snprintf _snprintf
|
|
#else
|
|
#error No support for snprintf detected!
|
|
#endif
|
|
#endif
|
|
|
|
template<size_t SIZE, typename... Args>
|
|
inline int sprintf_safe(char (&dest)[SIZE], const char* format, Args&&... args) {
|
|
auto written = snprintf(dest, SIZE, format, std::forward<Args>(args)...);
|
|
|
|
if (written < 0) {
|
|
return written;
|
|
}
|
|
|
|
if ((size_t)written >= SIZE) {
|
|
dest[SIZE - 1] = '\0';
|
|
}
|
|
return written;
|
|
}
|
|
|
|
#endif //FS2_OPEN_CASECMP_H
|