ホーム › Globalization › uspoof_openFromSource
uspoof_openFromSource
関数混同文字定義データから検査オブジェクトを生成する。
シグネチャ
// icuin.dll
#include <windows.h>
USpoofChecker* uspoof_openFromSource(
LPCSTR confusables,
INT confusablesLen,
LPCSTR confusablesWholeScript,
INT confusablesWholeScriptLen,
INT* errType,
UParseError* pe,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| confusables | LPCSTR | in |
| confusablesLen | INT | in |
| confusablesWholeScript | LPCSTR | in |
| confusablesWholeScriptLen | INT | in |
| errType | INT* | inout |
| pe | UParseError* | inout |
| status | UErrorCode* | inout |
戻り値の型: USpoofChecker*
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
USpoofChecker* uspoof_openFromSource(
LPCSTR confusables,
INT confusablesLen,
LPCSTR confusablesWholeScript,
INT confusablesWholeScriptLen,
INT* errType,
UParseError* pe,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr uspoof_openFromSource(
[MarshalAs(UnmanagedType.LPStr)] string confusables, // LPCSTR
int confusablesLen, // INT
[MarshalAs(UnmanagedType.LPStr)] string confusablesWholeScript, // LPCSTR
int confusablesWholeScriptLen, // INT
ref int errType, // INT* in/out
IntPtr pe, // UParseError* in/out
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uspoof_openFromSource(
<MarshalAs(UnmanagedType.LPStr)> confusables As String, ' LPCSTR
confusablesLen As Integer, ' INT
<MarshalAs(UnmanagedType.LPStr)> confusablesWholeScript As String, ' LPCSTR
confusablesWholeScriptLen As Integer, ' INT
ByRef errType As Integer, ' INT* in/out
pe As IntPtr, ' UParseError* in/out
ByRef status As Integer ' UErrorCode* in/out
) As IntPtr
End Function' confusables : LPCSTR
' confusablesLen : INT
' confusablesWholeScript : LPCSTR
' confusablesWholeScriptLen : INT
' errType : INT* in/out
' pe : UParseError* in/out
' status : UErrorCode* in/out
Declare PtrSafe Function uspoof_openFromSource Lib "icuin" ( _
ByVal confusables As String, _
ByVal confusablesLen As Long, _
ByVal confusablesWholeScript As String, _
ByVal confusablesWholeScriptLen As Long, _
ByRef errType As Long, _
ByVal pe As LongPtr, _
ByRef status As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
uspoof_openFromSource = ctypes.cdll.icuin.uspoof_openFromSource
uspoof_openFromSource.restype = ctypes.c_void_p
uspoof_openFromSource.argtypes = [
wintypes.LPCSTR, # confusables : LPCSTR
ctypes.c_int, # confusablesLen : INT
wintypes.LPCSTR, # confusablesWholeScript : LPCSTR
ctypes.c_int, # confusablesWholeScriptLen : INT
ctypes.POINTER(ctypes.c_int), # errType : INT* in/out
ctypes.c_void_p, # pe : UParseError* in/out
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
uspoof_openFromSource = Fiddle::Function.new(
lib['uspoof_openFromSource'],
[
Fiddle::TYPE_VOIDP, # confusables : LPCSTR
Fiddle::TYPE_INT, # confusablesLen : INT
Fiddle::TYPE_VOIDP, # confusablesWholeScript : LPCSTR
Fiddle::TYPE_INT, # confusablesWholeScriptLen : INT
Fiddle::TYPE_VOIDP, # errType : INT* in/out
Fiddle::TYPE_VOIDP, # pe : UParseError* in/out
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn uspoof_openFromSource(
confusables: *const u8, // LPCSTR
confusablesLen: i32, // INT
confusablesWholeScript: *const u8, // LPCSTR
confusablesWholeScriptLen: i32, // INT
errType: *mut i32, // INT* in/out
pe: *mut UParseError, // UParseError* in/out
status: *mut i32 // UErrorCode* in/out
) -> *mut isize;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr uspoof_openFromSource([MarshalAs(UnmanagedType.LPStr)] string confusables, int confusablesLen, [MarshalAs(UnmanagedType.LPStr)] string confusablesWholeScript, int confusablesWholeScriptLen, ref int errType, IntPtr pe, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_uspoof_openFromSource' -Namespace Win32 -PassThru
# $api::uspoof_openFromSource(confusables, confusablesLen, confusablesWholeScript, confusablesWholeScriptLen, errType, pe, status)#uselib "icuin.dll"
#func global uspoof_openFromSource "uspoof_openFromSource" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; uspoof_openFromSource confusables, confusablesLen, confusablesWholeScript, confusablesWholeScriptLen, varptr(errType), varptr(pe), status ; 戻り値は stat
; confusables : LPCSTR -> "sptr"
; confusablesLen : INT -> "sptr"
; confusablesWholeScript : LPCSTR -> "sptr"
; confusablesWholeScriptLen : INT -> "sptr"
; errType : INT* in/out -> "sptr"
; pe : UParseError* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global uspoof_openFromSource "uspoof_openFromSource" str, int, str, int, var, var, int ; res = uspoof_openFromSource(confusables, confusablesLen, confusablesWholeScript, confusablesWholeScriptLen, errType, pe, status) ; confusables : LPCSTR -> "str" ; confusablesLen : INT -> "int" ; confusablesWholeScript : LPCSTR -> "str" ; confusablesWholeScriptLen : INT -> "int" ; errType : INT* in/out -> "var" ; pe : UParseError* in/out -> "var" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global uspoof_openFromSource "uspoof_openFromSource" str, int, str, int, sptr, sptr, int ; res = uspoof_openFromSource(confusables, confusablesLen, confusablesWholeScript, confusablesWholeScriptLen, varptr(errType), varptr(pe), status) ; confusables : LPCSTR -> "str" ; confusablesLen : INT -> "int" ; confusablesWholeScript : LPCSTR -> "str" ; confusablesWholeScriptLen : INT -> "int" ; errType : INT* in/out -> "sptr" ; pe : UParseError* in/out -> "sptr" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; USpoofChecker* uspoof_openFromSource(LPCSTR confusables, INT confusablesLen, LPCSTR confusablesWholeScript, INT confusablesWholeScriptLen, INT* errType, UParseError* pe, UErrorCode* status) #uselib "icuin.dll" #cfunc global uspoof_openFromSource "uspoof_openFromSource" str, int, str, int, var, var, int ; res = uspoof_openFromSource(confusables, confusablesLen, confusablesWholeScript, confusablesWholeScriptLen, errType, pe, status) ; confusables : LPCSTR -> "str" ; confusablesLen : INT -> "int" ; confusablesWholeScript : LPCSTR -> "str" ; confusablesWholeScriptLen : INT -> "int" ; errType : INT* in/out -> "var" ; pe : UParseError* in/out -> "var" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; USpoofChecker* uspoof_openFromSource(LPCSTR confusables, INT confusablesLen, LPCSTR confusablesWholeScript, INT confusablesWholeScriptLen, INT* errType, UParseError* pe, UErrorCode* status) #uselib "icuin.dll" #cfunc global uspoof_openFromSource "uspoof_openFromSource" str, int, str, int, intptr, intptr, int ; res = uspoof_openFromSource(confusables, confusablesLen, confusablesWholeScript, confusablesWholeScriptLen, varptr(errType), varptr(pe), status) ; confusables : LPCSTR -> "str" ; confusablesLen : INT -> "int" ; confusablesWholeScript : LPCSTR -> "str" ; confusablesWholeScriptLen : INT -> "int" ; errType : INT* in/out -> "intptr" ; pe : UParseError* in/out -> "intptr" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procuspoof_openFromSource = icuin.NewProc("uspoof_openFromSource")
)
// confusables (LPCSTR), confusablesLen (INT), confusablesWholeScript (LPCSTR), confusablesWholeScriptLen (INT), errType (INT* in/out), pe (UParseError* in/out), status (UErrorCode* in/out)
r1, _, err := procuspoof_openFromSource.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(confusables))),
uintptr(confusablesLen),
uintptr(unsafe.Pointer(windows.BytePtrFromString(confusablesWholeScript))),
uintptr(confusablesWholeScriptLen),
uintptr(errType),
uintptr(pe),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // USpoofChecker*function uspoof_openFromSource(
confusables: PAnsiChar; // LPCSTR
confusablesLen: Integer; // INT
confusablesWholeScript: PAnsiChar; // LPCSTR
confusablesWholeScriptLen: Integer; // INT
errType: Pointer; // INT* in/out
pe: Pointer; // UParseError* in/out
status: Pointer // UErrorCode* in/out
): Pointer; cdecl;
external 'icuin.dll' name 'uspoof_openFromSource';result := DllCall("icuin\uspoof_openFromSource"
, "AStr", confusables ; LPCSTR
, "Int", confusablesLen ; INT
, "AStr", confusablesWholeScript ; LPCSTR
, "Int", confusablesWholeScriptLen ; INT
, "Ptr", errType ; INT* in/out
, "Ptr", pe ; UParseError* in/out
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Ptr") ; return: USpoofChecker*●uspoof_openFromSource(confusables, confusablesLen, confusablesWholeScript, confusablesWholeScriptLen, errType, pe, status) = DLL("icuin.dll", "void* uspoof_openFromSource(char*, int, char*, int, void*, void*, void*)")
# 呼び出し: uspoof_openFromSource(confusables, confusablesLen, confusablesWholeScript, confusablesWholeScriptLen, errType, pe, status)
# confusables : LPCSTR -> "char*"
# confusablesLen : INT -> "int"
# confusablesWholeScript : LPCSTR -> "char*"
# confusablesWholeScriptLen : INT -> "int"
# errType : INT* in/out -> "void*"
# pe : UParseError* in/out -> "void*"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。