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