mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-27 22:42:57 +00:00
- added CharUpper and CharLower functions to ZScript.
These, like MakeUpper and MakeLower, use the internal Unicode case conversion tables.
This commit is contained in:
parent
f7561f25d6
commit
3938119192
2 changed files with 28 additions and 0 deletions
|
@ -50,6 +50,7 @@
|
|||
#include "am_map.h"
|
||||
#include "v_video.h"
|
||||
#include "gi.h"
|
||||
#include "fontinternals.h"
|
||||
#include "intermission/intermission.h"
|
||||
|
||||
DVector2 AM_GetPosition();
|
||||
|
@ -285,6 +286,31 @@ DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, MakeLower, StringMakeLower)
|
|||
ACTION_RETURN_STRING(self->MakeLower());
|
||||
}
|
||||
|
||||
static int StringCharUpper(int ch)
|
||||
{
|
||||
return ch >= 0 && ch < 65536 ? upperforlower[ch] : ch;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, CharUpper, StringCharUpper)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(ch);
|
||||
ACTION_RETURN_INT(StringCharUpper(ch));
|
||||
}
|
||||
|
||||
static int StringCharLower(int ch)
|
||||
{
|
||||
return ch >= 0 && ch < 65536 ? lowerforupper[ch] : ch;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, CharLower, StringCharLower)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(ch);
|
||||
ACTION_RETURN_INT(StringCharLower(ch));
|
||||
}
|
||||
|
||||
|
||||
static int StringToInt(FString *self, int base)
|
||||
{
|
||||
return (int)self->ToLong(base);
|
||||
|
|
|
@ -909,6 +909,8 @@ struct StringStruct native
|
|||
deprecated("4.1") native void ToLower();
|
||||
native String MakeUpper();
|
||||
native String MakeLower();
|
||||
native static int CharUpper(int ch);
|
||||
native static int CharLower(int ch);
|
||||
native int ToInt(int base = 0) const;
|
||||
native double ToDouble() const;
|
||||
native void Split(out Array<String> tokens, String delimiter, EmptyTokenType keepEmpty = TOK_KEEPEMPTY) const;
|
||||
|
|
Loading…
Reference in a new issue