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