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

ucptrie_openFromBinary

関数
バイナリデータからコードポイントトライを開く。
DLLicu.dll呼出規約cdecl

シグネチャ

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

UCPTrie* ucptrie_openFromBinary(
    UCPTrieType type,
    UCPTrieValueWidth valueWidth,
    const void* data,
    INT length,
    INT* pActualLength,
    UErrorCode* pErrorCode
);

パラメーター

名前方向
typeUCPTrieTypein
valueWidthUCPTrieValueWidthin
datavoid*in
lengthINTin
pActualLengthINT*inout
pErrorCodeUErrorCode*inout

戻り値の型: UCPTrie*

各言語での呼び出し定義

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

UCPTrie* ucptrie_openFromBinary(
    UCPTrieType type,
    UCPTrieValueWidth valueWidth,
    const void* data,
    INT length,
    INT* pActualLength,
    UErrorCode* pErrorCode
);
[DllImport("icu.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ucptrie_openFromBinary(
    int type,   // UCPTrieType
    int valueWidth,   // UCPTrieValueWidth
    IntPtr data,   // void*
    int length,   // INT
    ref int pActualLength,   // INT* in/out
    ref int pErrorCode   // UErrorCode* in/out
);
<DllImport("icu.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucptrie_openFromBinary(
    type As Integer,   ' UCPTrieType
    valueWidth As Integer,   ' UCPTrieValueWidth
    data As IntPtr,   ' void*
    length As Integer,   ' INT
    ByRef pActualLength As Integer,   ' INT* in/out
    ByRef pErrorCode As Integer   ' UErrorCode* in/out
) As IntPtr
End Function
' type : UCPTrieType
' valueWidth : UCPTrieValueWidth
' data : void*
' length : INT
' pActualLength : INT* in/out
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function ucptrie_openFromBinary Lib "icu" ( _
    ByVal type As Long, _
    ByVal valueWidth As Long, _
    ByVal data As LongPtr, _
    ByVal length As Long, _
    ByRef pActualLength As Long, _
    ByRef pErrorCode As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ucptrie_openFromBinary = ctypes.cdll.icu.ucptrie_openFromBinary
ucptrie_openFromBinary.restype = ctypes.c_void_p
ucptrie_openFromBinary.argtypes = [
    ctypes.c_int,  # type : UCPTrieType
    ctypes.c_int,  # valueWidth : UCPTrieValueWidth
    ctypes.POINTER(None),  # data : void*
    ctypes.c_int,  # length : INT
    ctypes.POINTER(ctypes.c_int),  # pActualLength : INT* in/out
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icu.dll')
ucptrie_openFromBinary = Fiddle::Function.new(
  lib['ucptrie_openFromBinary'],
  [
    Fiddle::TYPE_INT,  # type : UCPTrieType
    Fiddle::TYPE_INT,  # valueWidth : UCPTrieValueWidth
    Fiddle::TYPE_VOIDP,  # data : void*
    Fiddle::TYPE_INT,  # length : INT
    Fiddle::TYPE_VOIDP,  # pActualLength : INT* in/out
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "icu")]
extern "C" {
    fn ucptrie_openFromBinary(
        type: i32,  // UCPTrieType
        valueWidth: i32,  // UCPTrieValueWidth
        data: *const (),  // void*
        length: i32,  // INT
        pActualLength: *mut i32,  // INT* in/out
        pErrorCode: *mut i32  // UErrorCode* in/out
    ) -> *mut UCPTrie;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icu.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ucptrie_openFromBinary(int type, int valueWidth, IntPtr data, int length, ref int pActualLength, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icu_ucptrie_openFromBinary' -Namespace Win32 -PassThru
# $api::ucptrie_openFromBinary(type, valueWidth, data, length, pActualLength, pErrorCode)
#uselib "icu.dll"
#func global ucptrie_openFromBinary "ucptrie_openFromBinary" sptr, sptr, sptr, sptr, sptr, sptr
; ucptrie_openFromBinary type, valueWidth, data, length, varptr(pActualLength), pErrorCode   ; 戻り値は stat
; type : UCPTrieType -> "sptr"
; valueWidth : UCPTrieValueWidth -> "sptr"
; data : void* -> "sptr"
; length : INT -> "sptr"
; pActualLength : INT* in/out -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icu.dll"
#cfunc global ucptrie_openFromBinary "ucptrie_openFromBinary" int, int, sptr, int, var, int
; res = ucptrie_openFromBinary(type, valueWidth, data, length, pActualLength, pErrorCode)
; type : UCPTrieType -> "int"
; valueWidth : UCPTrieValueWidth -> "int"
; data : void* -> "sptr"
; length : INT -> "int"
; pActualLength : INT* in/out -> "var"
; pErrorCode : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; UCPTrie* ucptrie_openFromBinary(UCPTrieType type, UCPTrieValueWidth valueWidth, void* data, INT length, INT* pActualLength, UErrorCode* pErrorCode)
#uselib "icu.dll"
#cfunc global ucptrie_openFromBinary "ucptrie_openFromBinary" int, int, intptr, int, var, int
; res = ucptrie_openFromBinary(type, valueWidth, data, length, pActualLength, pErrorCode)
; type : UCPTrieType -> "int"
; valueWidth : UCPTrieValueWidth -> "int"
; data : void* -> "intptr"
; length : INT -> "int"
; pActualLength : INT* in/out -> "var"
; pErrorCode : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icu = windows.NewLazySystemDLL("icu.dll")
	procucptrie_openFromBinary = icu.NewProc("ucptrie_openFromBinary")
)

// type (UCPTrieType), valueWidth (UCPTrieValueWidth), data (void*), length (INT), pActualLength (INT* in/out), pErrorCode (UErrorCode* in/out)
r1, _, err := procucptrie_openFromBinary.Call(
	uintptr(type),
	uintptr(valueWidth),
	uintptr(data),
	uintptr(length),
	uintptr(pActualLength),
	uintptr(pErrorCode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // UCPTrie*
function ucptrie_openFromBinary(
  type: Integer;   // UCPTrieType
  valueWidth: Integer;   // UCPTrieValueWidth
  data: Pointer;   // void*
  length: Integer;   // INT
  pActualLength: Pointer;   // INT* in/out
  pErrorCode: Pointer   // UErrorCode* in/out
): Pointer; cdecl;
  external 'icu.dll' name 'ucptrie_openFromBinary';
result := DllCall("icu\ucptrie_openFromBinary"
    , "Int", type   ; UCPTrieType
    , "Int", valueWidth   ; UCPTrieValueWidth
    , "Ptr", data   ; void*
    , "Int", length   ; INT
    , "Ptr", pActualLength   ; INT* in/out
    , "Ptr", pErrorCode   ; UErrorCode* in/out
    , "Cdecl Ptr")   ; return: UCPTrie*
●ucptrie_openFromBinary(type, valueWidth, data, length, pActualLength, pErrorCode) = DLL("icu.dll", "void* ucptrie_openFromBinary(int, int, void*, int, void*, void*)")
# 呼び出し: ucptrie_openFromBinary(type, valueWidth, data, length, pActualLength, pErrorCode)
# type : UCPTrieType -> "int"
# valueWidth : UCPTrieValueWidth -> "int"
# data : void* -> "void*"
# length : INT -> "int"
# pActualLength : INT* in/out -> "void*"
# pErrorCode : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。