ADD: ExtensionAPI - TranslateString function

This commit is contained in:
Alexander Koblov 2023-02-25 16:52:24 +03:00
commit 18536d96a9
6 changed files with 143 additions and 58 deletions

View file

@ -101,21 +101,23 @@ typedef int (DCPCALL *tMessageBoxProc)(char* Text, char* Caption, long Flags);
typedef BOOL (DCPCALL *tDialogBoxLFMProc)(intptr_t LFMData, unsigned long DataSize, tDlgProc DlgProc);
typedef BOOL (DCPCALL *tDialogBoxLRSProc)(intptr_t LRSData, unsigned long DataSize, tDlgProc DlgProc);
typedef BOOL (DCPCALL *tDialogBoxLFMFileProc)(char* LFMFileName, tDlgProc DlgProc);
typedef int (DCPCALL *tTranslateStringProc)(void *Translation, const char *Identifier, const char *Original, char *Output, int OutLen);
#pragma pack(push)
#pragma pack(1)
typedef struct {
uint32_t StructSize;
char PluginDir[EXT_MAX_PATH];
char PluginConfDir[EXT_MAX_PATH];
tInputBoxProc InputBox;
tMessageBoxProc MessageBox;
tDialogBoxLFMProc DialogBoxLFM;
tDialogBoxLRSProc DialogBoxLRS;
tDialogBoxLFMFileProc DialogBoxLFMFile;
tDlgProc SendDlgMsg;
unsigned char Reserved[4096 * sizeof(void *)];
uint32_t StructSize;
char PluginDir[EXT_MAX_PATH];
char PluginConfDir[EXT_MAX_PATH];
tInputBoxProc InputBox;
tMessageBoxProc MessageBox;
tDialogBoxLFMProc DialogBoxLFM;
tDialogBoxLRSProc DialogBoxLRS;
tDialogBoxLFMFileProc DialogBoxLFMFile;
tDlgProc SendDlgMsg;
void *Translation;
tTranslateStringProc TranslateString;
unsigned char Reserved[4094 * sizeof(void *)];
} tExtensionStartupInfo;
#pragma pack(pop)

View file

@ -108,6 +108,7 @@ type
TDialogBoxLFMProc = function(LFMData: Pointer; DataSize: LongWord; DlgProc: TDlgProc): LongBool; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
TDialogBoxLRSProc = function(LRSData: Pointer; DataSize: LongWord; DlgProc: TDlgProc): LongBool; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
TDialogBoxLFMFileProc = function(lfmFileName: PAnsiChar; DlgProc: TDlgProc): LongBool; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
TTranslateStringProc = function(Translation: Pointer; Identifier, Original: PAnsiChar; Output: PAnsiChar; OutLen: Integer): Integer {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
type
PExtensionStartupInfo = ^TExtensionStartupInfo;
@ -125,8 +126,10 @@ type
DialogBoxLRS: TDialogBoxLRSProc;
DialogBoxLFMFile: TDialogBoxLFMFileProc;
SendDlgMsg: TDlgProc;
Translation: Pointer;
TranslateString: TTranslateStringProc;
// Reserved for future API extension
Reserved: packed array [0..Pred(4096 * SizeOf(Pointer))] of Byte;
Reserved: packed array [0..Pred(4094 * SizeOf(Pointer))] of Byte;
end;
type