From f708ab57c583101f02002cd5a0b9c9b360e75021 Mon Sep 17 00:00:00 2001 From: ollydev Date: Tue, 6 Nov 2018 20:55:39 +0000 Subject: [PATCH] Export UTF8Encode and UTF8Decode. --- Units/MMLAddon/Imports/script_import_string.pas | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Units/MMLAddon/Imports/script_import_string.pas b/Units/MMLAddon/Imports/script_import_string.pas index 344745cf1..c05ced14b 100644 --- a/Units/MMLAddon/Imports/script_import_string.pas +++ b/Units/MMLAddon/Imports/script_import_string.pas @@ -120,6 +120,16 @@ procedure Lape_IsStrInArr(const Params: PParamArray; const Result: Pointer); {$I PBoolean(Result)^ := IsStrInArr(PString(Params^[0])^, PBoolean(Params^[1])^, PStringArray(Params^[2])^); end; +procedure Lape_UTF8Decode(const Params: PParamArray; const Result: Pointer); {$IFDEF Lape_CDECL}cdecl;{$ENDIF} +begin + PWideString(Result)^ := UTF8Decode(PString(Params^[0])^); +end; + +procedure Lape_UTF8Encode(const Params: PParamArray; const Result: Pointer); {$IFDEF Lape_CDECL}cdecl;{$ENDIF} +begin + PAnsiString(Result)^ := UTF8Encode(PWideString(Params^[0])^); +end; + procedure Lape_Import_String(Compiler: TLapeCompiler; Data: Pointer); begin with Compiler do @@ -147,6 +157,8 @@ procedure Lape_Import_String(Compiler: TLapeCompiler; Data: Pointer); addGlobalFunc('function IsArrInStr(constref Arr: TStringArray; S: String): Boolean;', @Lape_IsArrInStr); addGlobalFunc('function IsStrInArr(S: String; const UsePos: Boolean; const Arr: TStringArray): Boolean;', @Lape_IsStrInArr); addGlobalFunc('function PosMulti(const SubStr: String; Text: String): TIntegerArray;', @Lape_PosMulti); + addGlobalFunc('function UTF8Decode(constref S: AnsiString): WideString;', @Lape_UTF8Decode); + addGlobalFunc('function UTF8Encode(constref S: WideString): AnsiString;', @Lape_UTF8Encode); end; end;