ホーム › Globalization › uspoof_getSkeleton
uspoof_getSkeleton
関数混同判定用の文字列スケルトンを生成する。
シグネチャ
// icuin.dll
#include <windows.h>
INT uspoof_getSkeleton(
const USpoofChecker* sc,
DWORD type,
const WORD* id,
INT length,
WORD* dest,
INT destCapacity,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| sc | USpoofChecker* | in | 対象のUSpoofCheckerへのポインター。 |
| type | DWORD | in | 非推奨のスケルトン種別フラグ。通常は0を指定する。 |
| id | WORD* | in | スケルトンを生成する元の識別子を指すUTF-16コード単位(WORD)配列へのポインター。 |
| length | INT | in | 識別子の長さ(コード単位数)。NUL終端なら-1を指定可能。 |
| dest | WORD* | inout | 生成されたスケルトン文字列を格納する出力バッファへのポインター。 |
| destCapacity | INT | in | destバッファの容量(コード単位数)。 |
| status | UErrorCode* | inout | ICUのエラーコードを入出力するUErrorCodeへのポインター。 |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT uspoof_getSkeleton(
const USpoofChecker* sc,
DWORD type,
const WORD* id,
INT length,
WORD* dest,
INT destCapacity,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int uspoof_getSkeleton(
ref IntPtr sc, // USpoofChecker*
uint type, // DWORD
ref ushort id, // WORD*
int length, // INT
ref ushort dest, // WORD* in/out
int destCapacity, // INT
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uspoof_getSkeleton(
ByRef sc As IntPtr, ' USpoofChecker*
type As UInteger, ' DWORD
ByRef id As UShort, ' WORD*
length As Integer, ' INT
ByRef dest As UShort, ' WORD* in/out
destCapacity As Integer, ' INT
ByRef status As Integer ' UErrorCode* in/out
) As Integer
End Function' sc : USpoofChecker*
' type : DWORD
' id : WORD*
' length : INT
' dest : WORD* in/out
' destCapacity : INT
' status : UErrorCode* in/out
Declare PtrSafe Function uspoof_getSkeleton Lib "icuin" ( _
ByRef sc As LongPtr, _
ByVal type As Long, _
ByRef id As Integer, _
ByVal length As Long, _
ByRef dest As Integer, _
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_getSkeleton = ctypes.cdll.icuin.uspoof_getSkeleton
uspoof_getSkeleton.restype = ctypes.c_int
uspoof_getSkeleton.argtypes = [
ctypes.c_void_p, # sc : USpoofChecker*
wintypes.DWORD, # type : DWORD
ctypes.POINTER(ctypes.c_ushort), # id : WORD*
ctypes.c_int, # length : INT
ctypes.POINTER(ctypes.c_ushort), # dest : WORD* in/out
ctypes.c_int, # destCapacity : INT
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
uspoof_getSkeleton = Fiddle::Function.new(
lib['uspoof_getSkeleton'],
[
Fiddle::TYPE_VOIDP, # sc : USpoofChecker*
-Fiddle::TYPE_INT, # type : DWORD
Fiddle::TYPE_VOIDP, # id : WORD*
Fiddle::TYPE_INT, # length : INT
Fiddle::TYPE_VOIDP, # dest : WORD* in/out
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_getSkeleton(
sc: *const isize, // USpoofChecker*
type: u32, // DWORD
id: *const u16, // WORD*
length: i32, // INT
dest: *mut u16, // WORD* in/out
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_getSkeleton(ref IntPtr sc, uint type, ref ushort id, int length, ref ushort dest, int destCapacity, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_uspoof_getSkeleton' -Namespace Win32 -PassThru
# $api::uspoof_getSkeleton(sc, type, id, length, dest, destCapacity, status)#uselib "icuin.dll"
#func global uspoof_getSkeleton "uspoof_getSkeleton" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; uspoof_getSkeleton varptr(sc), type, varptr(id), length, varptr(dest), destCapacity, varptr(status) ; 戻り値は stat
; sc : USpoofChecker* -> "sptr"
; type : DWORD -> "sptr"
; id : WORD* -> "sptr"
; length : INT -> "sptr"
; dest : WORD* in/out -> "sptr"
; destCapacity : INT -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global uspoof_getSkeleton "uspoof_getSkeleton" var, int, var, int, var, int, var ; res = uspoof_getSkeleton(sc, type, id, length, dest, destCapacity, status) ; sc : USpoofChecker* -> "var" ; type : DWORD -> "int" ; id : WORD* -> "var" ; length : INT -> "int" ; dest : WORD* in/out -> "var" ; destCapacity : INT -> "int" ; status : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global uspoof_getSkeleton "uspoof_getSkeleton" sptr, int, sptr, int, sptr, int, sptr ; res = uspoof_getSkeleton(varptr(sc), type, varptr(id), length, varptr(dest), destCapacity, varptr(status)) ; sc : USpoofChecker* -> "sptr" ; type : DWORD -> "int" ; id : WORD* -> "sptr" ; length : INT -> "int" ; dest : WORD* in/out -> "sptr" ; destCapacity : INT -> "int" ; status : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT uspoof_getSkeleton(USpoofChecker* sc, DWORD type, WORD* id, INT length, WORD* dest, INT destCapacity, UErrorCode* status) #uselib "icuin.dll" #cfunc global uspoof_getSkeleton "uspoof_getSkeleton" var, int, var, int, var, int, var ; res = uspoof_getSkeleton(sc, type, id, length, dest, destCapacity, status) ; sc : USpoofChecker* -> "var" ; type : DWORD -> "int" ; id : WORD* -> "var" ; length : INT -> "int" ; dest : WORD* in/out -> "var" ; destCapacity : INT -> "int" ; status : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT uspoof_getSkeleton(USpoofChecker* sc, DWORD type, WORD* id, INT length, WORD* dest, INT destCapacity, UErrorCode* status) #uselib "icuin.dll" #cfunc global uspoof_getSkeleton "uspoof_getSkeleton" intptr, int, intptr, int, intptr, int, intptr ; res = uspoof_getSkeleton(varptr(sc), type, varptr(id), length, varptr(dest), destCapacity, varptr(status)) ; sc : USpoofChecker* -> "intptr" ; type : DWORD -> "int" ; id : WORD* -> "intptr" ; length : INT -> "int" ; dest : WORD* in/out -> "intptr" ; destCapacity : INT -> "int" ; status : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procuspoof_getSkeleton = icuin.NewProc("uspoof_getSkeleton")
)
// sc (USpoofChecker*), type (DWORD), id (WORD*), length (INT), dest (WORD* in/out), destCapacity (INT), status (UErrorCode* in/out)
r1, _, err := procuspoof_getSkeleton.Call(
uintptr(sc),
uintptr(type),
uintptr(id),
uintptr(length),
uintptr(dest),
uintptr(destCapacity),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction uspoof_getSkeleton(
sc: Pointer; // USpoofChecker*
type: DWORD; // DWORD
id: Pointer; // WORD*
length: Integer; // INT
dest: Pointer; // WORD* in/out
destCapacity: Integer; // INT
status: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'uspoof_getSkeleton';result := DllCall("icuin\uspoof_getSkeleton"
, "Ptr", sc ; USpoofChecker*
, "UInt", type ; DWORD
, "Ptr", id ; WORD*
, "Int", length ; INT
, "Ptr", dest ; WORD* in/out
, "Int", destCapacity ; INT
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●uspoof_getSkeleton(sc, type, id, length, dest, destCapacity, status) = DLL("icuin.dll", "int uspoof_getSkeleton(void*, dword, void*, int, void*, int, void*)")
# 呼び出し: uspoof_getSkeleton(sc, type, id, length, dest, destCapacity, status)
# sc : USpoofChecker* -> "void*"
# type : DWORD -> "dword"
# id : WORD* -> "void*"
# length : INT -> "int"
# dest : WORD* in/out -> "void*"
# destCapacity : INT -> "int"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "icuin" fn uspoof_getSkeleton(
sc: [*c]isize, // USpoofChecker*
type: u32, // DWORD
id: [*c]u16, // WORD*
length: i32, // INT
dest: [*c]u16, // WORD* in/out
destCapacity: i32, // INT
status: [*c]i32 // UErrorCode* in/out
) callconv(.c) i32;proc uspoof_getSkeleton(
sc: ptr int, # USpoofChecker*
`type`: uint32, # DWORD
id: ptr uint16, # WORD*
length: int32, # INT
dest: ptr uint16, # WORD* in/out
destCapacity: int32, # INT
status: ptr int32 # UErrorCode* in/out
): int32 {.importc: "uspoof_getSkeleton", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
int uspoof_getSkeleton(
ptrdiff_t* sc, // USpoofChecker*
uint type, // DWORD
ushort* id, // WORD*
int length, // INT
ushort* dest, // WORD* in/out
int destCapacity, // INT
int* status // UErrorCode* in/out
);ccall((:uspoof_getSkeleton, "icuin.dll"), Int32,
(Ptr{Int}, UInt32, Ptr{UInt16}, Int32, Ptr{UInt16}, Int32, Ptr{Int32}),
sc, type, id, length, dest, destCapacity, status)
# sc : USpoofChecker* -> Ptr{Int}
# type : DWORD -> UInt32
# id : WORD* -> Ptr{UInt16}
# length : INT -> Int32
# dest : WORD* in/out -> Ptr{UInt16}
# destCapacity : INT -> Int32
# status : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
int32_t uspoof_getSkeleton(
intptr_t* sc,
uint32_t type,
uint16_t* id,
int32_t length,
uint16_t* dest,
int32_t destCapacity,
int32_t* status);
]]
local icuin = ffi.load("icuin")
-- icuin.uspoof_getSkeleton(sc, type, id, length, dest, destCapacity, status)
-- sc : USpoofChecker*
-- type : DWORD
-- id : WORD*
-- length : INT
-- dest : WORD* in/out
-- destCapacity : INT
-- status : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const uspoof_getSkeleton = lib.func('__cdecl', 'uspoof_getSkeleton', 'int32_t', ['intptr_t *', 'uint32_t', 'uint16_t *', 'int32_t', 'uint16_t *', 'int32_t', 'int32_t *']);
// uspoof_getSkeleton(sc, type, id, length, dest, destCapacity, status)
// sc : USpoofChecker* -> 'intptr_t *'
// type : DWORD -> 'uint32_t'
// id : WORD* -> 'uint16_t *'
// length : INT -> 'int32_t'
// dest : WORD* in/out -> 'uint16_t *'
// destCapacity : INT -> 'int32_t'
// status : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
uspoof_getSkeleton: { parameters: ["pointer", "u32", "pointer", "i32", "pointer", "i32", "pointer"], result: "i32" },
});
// lib.symbols.uspoof_getSkeleton(sc, type, id, length, dest, destCapacity, status)
// sc : USpoofChecker* -> "pointer"
// type : DWORD -> "u32"
// id : WORD* -> "pointer"
// length : INT -> "i32"
// dest : WORD* in/out -> "pointer"
// destCapacity : INT -> "i32"
// status : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t uspoof_getSkeleton(
intptr_t* sc,
uint32_t type,
uint16_t* id,
int32_t length,
uint16_t* dest,
int32_t destCapacity,
int32_t* status);
C, "icuin.dll");
// $ffi->uspoof_getSkeleton(sc, type, id, length, dest, destCapacity, status);
// sc : USpoofChecker*
// type : DWORD
// id : WORD*
// length : INT
// dest : WORD* in/out
// destCapacity : INT
// status : UErrorCode* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Icuin extends Library {
Icuin INSTANCE = Native.load("icuin", Icuin.class);
int uspoof_getSkeleton(
LongByReference sc, // USpoofChecker*
int type, // DWORD
ShortByReference id, // WORD*
int length, // INT
ShortByReference dest, // WORD* in/out
int destCapacity, // INT
IntByReference status // UErrorCode* in/out
);
}@[Link("icuin")]
lib Libicuin
fun uspoof_getSkeleton = uspoof_getSkeleton(
sc : LibC::SSizeT*, # USpoofChecker*
type_ : UInt32, # DWORD
id : UInt16*, # WORD*
length : Int32, # INT
dest : UInt16*, # WORD* in/out
destCapacity : Int32, # INT
status : Int32* # UErrorCode* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef uspoof_getSkeletonNative = Int32 Function(Pointer<IntPtr>, Uint32, Pointer<Uint16>, Int32, Pointer<Uint16>, Int32, Pointer<Int32>);
typedef uspoof_getSkeletonDart = int Function(Pointer<IntPtr>, int, Pointer<Uint16>, int, Pointer<Uint16>, int, Pointer<Int32>);
final uspoof_getSkeleton = DynamicLibrary.open('icuin.dll')
.lookupFunction<uspoof_getSkeletonNative, uspoof_getSkeletonDart>('uspoof_getSkeleton');
// sc : USpoofChecker* -> Pointer<IntPtr>
// type : DWORD -> Uint32
// id : WORD* -> Pointer<Uint16>
// length : INT -> Int32
// dest : WORD* in/out -> Pointer<Uint16>
// destCapacity : INT -> Int32
// status : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function uspoof_getSkeleton(
sc: Pointer; // USpoofChecker*
type: DWORD; // DWORD
id: Pointer; // WORD*
length: Integer; // INT
dest: Pointer; // WORD* in/out
destCapacity: Integer; // INT
status: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'uspoof_getSkeleton';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "uspoof_getSkeleton"
c_uspoof_getSkeleton :: Ptr CIntPtr -> Word32 -> Ptr Word16 -> Int32 -> Ptr Word16 -> Int32 -> Ptr Int32 -> IO Int32
-- sc : USpoofChecker* -> Ptr CIntPtr
-- type : DWORD -> Word32
-- id : WORD* -> Ptr Word16
-- length : INT -> Int32
-- dest : WORD* in/out -> Ptr Word16
-- destCapacity : INT -> Int32
-- status : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let uspoof_getskeleton =
foreign "uspoof_getSkeleton"
((ptr intptr_t) @-> uint32_t @-> (ptr uint16_t) @-> int32_t @-> (ptr uint16_t) @-> int32_t @-> (ptr int32_t) @-> returning int32_t)
(* sc : USpoofChecker* -> (ptr intptr_t) *)
(* type : DWORD -> uint32_t *)
(* id : WORD* -> (ptr uint16_t) *)
(* length : INT -> int32_t *)
(* dest : WORD* in/out -> (ptr uint16_t) *)
(* destCapacity : INT -> int32_t *)
(* status : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)
(cffi:defcfun ("uspoof_getSkeleton" uspoof-get-skeleton :convention :cdecl) :int32
(sc :pointer) ; USpoofChecker*
(type :uint32) ; DWORD
(id :pointer) ; WORD*
(length :int32) ; INT
(dest :pointer) ; WORD* in/out
(dest-capacity :int32) ; INT
(status :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $uspoof_getSkeleton = Win32::API::More->new('icuin',
'int uspoof_getSkeleton(LPVOID sc, DWORD type, LPVOID id, int length, LPVOID dest, int destCapacity, LPVOID status)');
# my $ret = $uspoof_getSkeleton->Call($sc, $type, $id, $length, $dest, $destCapacity, $status);
# sc : USpoofChecker* -> LPVOID
# type : DWORD -> DWORD
# id : WORD* -> LPVOID
# length : INT -> int
# dest : WORD* in/out -> LPVOID
# destCapacity : INT -> int
# status : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型