Win32 API 日本語リファレンス
ホームGlobalization › uspoof_getSkeletonUTF8

uspoof_getSkeletonUTF8

関数
UTF-8文字列の混同判定用スケルトンを生成する。
DLLicuin.dll呼出規約cdecl

シグネチャ

// icuin.dll
#include <windows.h>

INT uspoof_getSkeletonUTF8(
    const USpoofChecker* sc,
    DWORD type,
    LPCSTR id,
    INT length,
    LPSTR dest,
    INT destCapacity,
    UErrorCode* status
);

パラメーター

名前方向
scUSpoofChecker*in
typeDWORDin
idLPCSTRin
lengthINTin
destLPSTRin
destCapacityINTin
statusUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

// icuin.dll
#include <windows.h>

INT uspoof_getSkeletonUTF8(
    const USpoofChecker* sc,
    DWORD type,
    LPCSTR id,
    INT length,
    LPSTR dest,
    INT destCapacity,
    UErrorCode* status
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int uspoof_getSkeletonUTF8(
    ref IntPtr sc,   // USpoofChecker*
    uint type,   // DWORD
    [MarshalAs(UnmanagedType.LPStr)] string id,   // LPCSTR
    int length,   // INT
    [MarshalAs(UnmanagedType.LPStr)] string dest,   // LPSTR
    int destCapacity,   // INT
    ref int status   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uspoof_getSkeletonUTF8(
    ByRef sc As IntPtr,   ' USpoofChecker*
    type As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPStr)> id As String,   ' LPCSTR
    length As Integer,   ' INT
    <MarshalAs(UnmanagedType.LPStr)> dest As String,   ' LPSTR
    destCapacity As Integer,   ' INT
    ByRef status As Integer   ' UErrorCode* in/out
) As Integer
End Function
' sc : USpoofChecker*
' type : DWORD
' id : LPCSTR
' length : INT
' dest : LPSTR
' destCapacity : INT
' status : UErrorCode* in/out
Declare PtrSafe Function uspoof_getSkeletonUTF8 Lib "icuin" ( _
    ByRef sc As LongPtr, _
    ByVal type As Long, _
    ByVal id As String, _
    ByVal length As Long, _
    ByVal dest As String, _
    ByVal destCapacity As Long, _
    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_getSkeletonUTF8 = ctypes.cdll.icuin.uspoof_getSkeletonUTF8
uspoof_getSkeletonUTF8.restype = ctypes.c_int
uspoof_getSkeletonUTF8.argtypes = [
    ctypes.c_void_p,  # sc : USpoofChecker*
    wintypes.DWORD,  # type : DWORD
    wintypes.LPCSTR,  # id : LPCSTR
    ctypes.c_int,  # length : INT
    wintypes.LPCSTR,  # dest : LPSTR
    ctypes.c_int,  # destCapacity : INT
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
uspoof_getSkeletonUTF8 = Fiddle::Function.new(
  lib['uspoof_getSkeletonUTF8'],
  [
    Fiddle::TYPE_VOIDP,  # sc : USpoofChecker*
    -Fiddle::TYPE_INT,  # type : DWORD
    Fiddle::TYPE_VOIDP,  # id : LPCSTR
    Fiddle::TYPE_INT,  # length : INT
    Fiddle::TYPE_VOIDP,  # dest : LPSTR
    Fiddle::TYPE_INT,  # destCapacity : INT
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn uspoof_getSkeletonUTF8(
        sc: *const isize,  // USpoofChecker*
        type: u32,  // DWORD
        id: *const u8,  // LPCSTR
        length: i32,  // INT
        dest: *mut u8,  // LPSTR
        destCapacity: i32,  // INT
        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_getSkeletonUTF8(ref IntPtr sc, uint type, [MarshalAs(UnmanagedType.LPStr)] string id, int length, [MarshalAs(UnmanagedType.LPStr)] string dest, int destCapacity, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_uspoof_getSkeletonUTF8' -Namespace Win32 -PassThru
# $api::uspoof_getSkeletonUTF8(sc, type, id, length, dest, destCapacity, status)
#uselib "icuin.dll"
#func global uspoof_getSkeletonUTF8 "uspoof_getSkeletonUTF8" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; uspoof_getSkeletonUTF8 sc, type, id, length, dest, destCapacity, status   ; 戻り値は stat
; sc : USpoofChecker* -> "sptr"
; type : DWORD -> "sptr"
; id : LPCSTR -> "sptr"
; length : INT -> "sptr"
; dest : LPSTR -> "sptr"
; destCapacity : INT -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "icuin.dll"
#cfunc global uspoof_getSkeletonUTF8 "uspoof_getSkeletonUTF8" int, int, str, int, str, int, int
; res = uspoof_getSkeletonUTF8(sc, type, id, length, dest, destCapacity, status)
; sc : USpoofChecker* -> "int"
; type : DWORD -> "int"
; id : LPCSTR -> "str"
; length : INT -> "int"
; dest : LPSTR -> "str"
; destCapacity : INT -> "int"
; status : UErrorCode* in/out -> "int"
; INT uspoof_getSkeletonUTF8(USpoofChecker* sc, DWORD type, LPCSTR id, INT length, LPSTR dest, INT destCapacity, UErrorCode* status)
#uselib "icuin.dll"
#cfunc global uspoof_getSkeletonUTF8 "uspoof_getSkeletonUTF8" int, int, str, int, str, int, int
; res = uspoof_getSkeletonUTF8(sc, type, id, length, dest, destCapacity, status)
; sc : USpoofChecker* -> "int"
; type : DWORD -> "int"
; id : LPCSTR -> "str"
; length : INT -> "int"
; dest : LPSTR -> "str"
; destCapacity : INT -> "int"
; status : UErrorCode* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procuspoof_getSkeletonUTF8 = icuin.NewProc("uspoof_getSkeletonUTF8")
)

// sc (USpoofChecker*), type (DWORD), id (LPCSTR), length (INT), dest (LPSTR), destCapacity (INT), status (UErrorCode* in/out)
r1, _, err := procuspoof_getSkeletonUTF8.Call(
	uintptr(sc),
	uintptr(type),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(id))),
	uintptr(length),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(dest))),
	uintptr(destCapacity),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function uspoof_getSkeletonUTF8(
  sc: Pointer;   // USpoofChecker*
  type: DWORD;   // DWORD
  id: PAnsiChar;   // LPCSTR
  length: Integer;   // INT
  dest: PAnsiChar;   // LPSTR
  destCapacity: Integer;   // INT
  status: Pointer   // UErrorCode* in/out
): Integer; cdecl;
  external 'icuin.dll' name 'uspoof_getSkeletonUTF8';
result := DllCall("icuin\uspoof_getSkeletonUTF8"
    , "Ptr", sc   ; USpoofChecker*
    , "UInt", type   ; DWORD
    , "AStr", id   ; LPCSTR
    , "Int", length   ; INT
    , "AStr", dest   ; LPSTR
    , "Int", destCapacity   ; INT
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Int")   ; return: INT
●uspoof_getSkeletonUTF8(sc, type, id, length, dest, destCapacity, status) = DLL("icuin.dll", "int uspoof_getSkeletonUTF8(void*, dword, char*, int, char*, int, void*)")
# 呼び出し: uspoof_getSkeletonUTF8(sc, type, id, length, dest, destCapacity, status)
# sc : USpoofChecker* -> "void*"
# type : DWORD -> "dword"
# id : LPCSTR -> "char*"
# length : INT -> "int"
# dest : LPSTR -> "char*"
# destCapacity : INT -> "int"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。