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

umutablecptrie_buildImmutable

関数
可変トライから不変コードポイントトライを構築する。
DLLicu.dll呼出規約cdecl

シグネチャ

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

UCPTrie* umutablecptrie_buildImmutable(
    UMutableCPTrie* trie,
    UCPTrieType type,
    UCPTrieValueWidth valueWidth,
    UErrorCode* pErrorCode
);

パラメーター

名前方向説明
trieUMutableCPTrie*inoutビルド元の可変トライへのポインタ。
typeUCPTrieTypein生成する不変トライの種別(FAST/SMALL)。
valueWidthUCPTrieValueWidthin生成する不変トライの値の幅(16/32/8ビット)。
pErrorCodeUErrorCode*inoutICOのエラーコードを入出力するポインタ。事前にU_ZERO_ERRORで初期化する。

戻り値の型: UCPTrie*

各言語での呼び出し定義

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

UCPTrie* umutablecptrie_buildImmutable(
    UMutableCPTrie* trie,
    UCPTrieType type,
    UCPTrieValueWidth valueWidth,
    UErrorCode* pErrorCode
);
[DllImport("icu.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr umutablecptrie_buildImmutable(
    ref IntPtr trie,   // UMutableCPTrie* in/out
    int type,   // UCPTrieType
    int valueWidth,   // UCPTrieValueWidth
    ref int pErrorCode   // UErrorCode* in/out
);
<DllImport("icu.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function umutablecptrie_buildImmutable(
    ByRef trie As IntPtr,   ' UMutableCPTrie* in/out
    type As Integer,   ' UCPTrieType
    valueWidth As Integer,   ' UCPTrieValueWidth
    ByRef pErrorCode As Integer   ' UErrorCode* in/out
) As IntPtr
End Function
' trie : UMutableCPTrie* in/out
' type : UCPTrieType
' valueWidth : UCPTrieValueWidth
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function umutablecptrie_buildImmutable Lib "icu" ( _
    ByRef trie As LongPtr, _
    ByVal type As Long, _
    ByVal valueWidth 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

umutablecptrie_buildImmutable = ctypes.cdll.icu.umutablecptrie_buildImmutable
umutablecptrie_buildImmutable.restype = ctypes.c_void_p
umutablecptrie_buildImmutable.argtypes = [
    ctypes.c_void_p,  # trie : UMutableCPTrie* in/out
    ctypes.c_int,  # type : UCPTrieType
    ctypes.c_int,  # valueWidth : UCPTrieValueWidth
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icu.dll')
umutablecptrie_buildImmutable = Fiddle::Function.new(
  lib['umutablecptrie_buildImmutable'],
  [
    Fiddle::TYPE_VOIDP,  # trie : UMutableCPTrie* in/out
    Fiddle::TYPE_INT,  # type : UCPTrieType
    Fiddle::TYPE_INT,  # valueWidth : UCPTrieValueWidth
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "icu")]
extern "C" {
    fn umutablecptrie_buildImmutable(
        trie: *mut isize,  // UMutableCPTrie* in/out
        type: i32,  // UCPTrieType
        valueWidth: i32,  // UCPTrieValueWidth
        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 umutablecptrie_buildImmutable(ref IntPtr trie, int type, int valueWidth, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icu_umutablecptrie_buildImmutable' -Namespace Win32 -PassThru
# $api::umutablecptrie_buildImmutable(trie, type, valueWidth, pErrorCode)
#uselib "icu.dll"
#func global umutablecptrie_buildImmutable "umutablecptrie_buildImmutable" sptr, sptr, sptr, sptr
; umutablecptrie_buildImmutable varptr(trie), type, valueWidth, varptr(pErrorCode)   ; 戻り値は stat
; trie : UMutableCPTrie* in/out -> "sptr"
; type : UCPTrieType -> "sptr"
; valueWidth : UCPTrieValueWidth -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icu.dll"
#cfunc global umutablecptrie_buildImmutable "umutablecptrie_buildImmutable" var, int, int, var
; res = umutablecptrie_buildImmutable(trie, type, valueWidth, pErrorCode)
; trie : UMutableCPTrie* in/out -> "var"
; type : UCPTrieType -> "int"
; valueWidth : UCPTrieValueWidth -> "int"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; UCPTrie* umutablecptrie_buildImmutable(UMutableCPTrie* trie, UCPTrieType type, UCPTrieValueWidth valueWidth, UErrorCode* pErrorCode)
#uselib "icu.dll"
#cfunc global umutablecptrie_buildImmutable "umutablecptrie_buildImmutable" var, int, int, var
; res = umutablecptrie_buildImmutable(trie, type, valueWidth, pErrorCode)
; trie : UMutableCPTrie* in/out -> "var"
; type : UCPTrieType -> "int"
; valueWidth : UCPTrieValueWidth -> "int"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icu = windows.NewLazySystemDLL("icu.dll")
	procumutablecptrie_buildImmutable = icu.NewProc("umutablecptrie_buildImmutable")
)

// trie (UMutableCPTrie* in/out), type (UCPTrieType), valueWidth (UCPTrieValueWidth), pErrorCode (UErrorCode* in/out)
r1, _, err := procumutablecptrie_buildImmutable.Call(
	uintptr(trie),
	uintptr(type),
	uintptr(valueWidth),
	uintptr(pErrorCode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // UCPTrie*
function umutablecptrie_buildImmutable(
  trie: Pointer;   // UMutableCPTrie* in/out
  type: Integer;   // UCPTrieType
  valueWidth: Integer;   // UCPTrieValueWidth
  pErrorCode: Pointer   // UErrorCode* in/out
): Pointer; cdecl;
  external 'icu.dll' name 'umutablecptrie_buildImmutable';
result := DllCall("icu\umutablecptrie_buildImmutable"
    , "Ptr", trie   ; UMutableCPTrie* in/out
    , "Int", type   ; UCPTrieType
    , "Int", valueWidth   ; UCPTrieValueWidth
    , "Ptr", pErrorCode   ; UErrorCode* in/out
    , "Cdecl Ptr")   ; return: UCPTrie*
●umutablecptrie_buildImmutable(trie, type, valueWidth, pErrorCode) = DLL("icu.dll", "void* umutablecptrie_buildImmutable(void*, int, int, void*)")
# 呼び出し: umutablecptrie_buildImmutable(trie, type, valueWidth, pErrorCode)
# trie : UMutableCPTrie* in/out -> "void*"
# type : UCPTrieType -> "int"
# valueWidth : UCPTrieValueWidth -> "int"
# pErrorCode : 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 "icu" fn umutablecptrie_buildImmutable(
    trie: [*c]isize, // UMutableCPTrie* in/out
    type: i32, // UCPTrieType
    valueWidth: i32, // UCPTrieValueWidth
    pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) [*c]UCPTrie;
proc umutablecptrie_buildImmutable(
    trie: ptr int,  # UMutableCPTrie* in/out
    `type`: int32,  # UCPTrieType
    valueWidth: int32,  # UCPTrieValueWidth
    pErrorCode: ptr int32  # UErrorCode* in/out
): ptr UCPTrie {.importc: "umutablecptrie_buildImmutable", cdecl, dynlib: "icu.dll".}
pragma(lib, "icu");
extern(C)
UCPTrie* umutablecptrie_buildImmutable(
    ptrdiff_t* trie,   // UMutableCPTrie* in/out
    int type,   // UCPTrieType
    int valueWidth,   // UCPTrieValueWidth
    int* pErrorCode   // UErrorCode* in/out
);
ccall((:umutablecptrie_buildImmutable, "icu.dll"), Ptr{UCPTrie},
      (Ptr{Int}, Int32, Int32, Ptr{Int32}),
      trie, type, valueWidth, pErrorCode)
# trie : UMutableCPTrie* in/out -> Ptr{Int}
# type : UCPTrieType -> Int32
# valueWidth : UCPTrieValueWidth -> Int32
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}
local ffi = require("ffi")
ffi.cdef[[
void* umutablecptrie_buildImmutable(
    intptr_t* trie,
    int32_t type,
    int32_t valueWidth,
    int32_t* pErrorCode);
]]
local icu = ffi.load("icu")
-- icu.umutablecptrie_buildImmutable(trie, type, valueWidth, pErrorCode)
-- trie : UMutableCPTrie* in/out
-- type : UCPTrieType
-- valueWidth : UCPTrieValueWidth
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icu.dll');
const umutablecptrie_buildImmutable = lib.func('__cdecl', 'umutablecptrie_buildImmutable', 'void *', ['intptr_t *', 'int32_t', 'int32_t', 'int32_t *']);
// umutablecptrie_buildImmutable(trie, type, valueWidth, pErrorCode)
// trie : UMutableCPTrie* in/out -> 'intptr_t *'
// type : UCPTrieType -> 'int32_t'
// valueWidth : UCPTrieValueWidth -> 'int32_t'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icu.dll", {
  umutablecptrie_buildImmutable: { parameters: ["pointer", "i32", "i32", "pointer"], result: "pointer" },
});
// lib.symbols.umutablecptrie_buildImmutable(trie, type, valueWidth, pErrorCode)
// trie : UMutableCPTrie* in/out -> "pointer"
// type : UCPTrieType -> "i32"
// valueWidth : UCPTrieValueWidth -> "i32"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void* umutablecptrie_buildImmutable(
    intptr_t* trie,
    int32_t type,
    int32_t valueWidth,
    int32_t* pErrorCode);
C, "icu.dll");
// $ffi->umutablecptrie_buildImmutable(trie, type, valueWidth, pErrorCode);
// trie : UMutableCPTrie* in/out
// type : UCPTrieType
// valueWidth : UCPTrieValueWidth
// pErrorCode : 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 Icu extends Library {
    Icu INSTANCE = Native.load("icu", Icu.class);
    Pointer umutablecptrie_buildImmutable(
        LongByReference trie,   // UMutableCPTrie* in/out
        int type,   // UCPTrieType
        int valueWidth,   // UCPTrieValueWidth
        IntByReference pErrorCode   // UErrorCode* in/out
    );
}
@[Link("icu")]
lib Libicu
  fun umutablecptrie_buildImmutable = umutablecptrie_buildImmutable(
    trie : LibC::SSizeT*,   # UMutableCPTrie* in/out
    type_ : Int32,   # UCPTrieType
    valueWidth : Int32,   # UCPTrieValueWidth
    pErrorCode : Int32*   # UErrorCode* in/out
  ) : UCPTrie*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef umutablecptrie_buildImmutableNative = Pointer<Void> Function(Pointer<IntPtr>, Int32, Int32, Pointer<Int32>);
typedef umutablecptrie_buildImmutableDart = Pointer<Void> Function(Pointer<IntPtr>, int, int, Pointer<Int32>);
final umutablecptrie_buildImmutable = DynamicLibrary.open('icu.dll')
    .lookupFunction<umutablecptrie_buildImmutableNative, umutablecptrie_buildImmutableDart>('umutablecptrie_buildImmutable');
// trie : UMutableCPTrie* in/out -> Pointer<IntPtr>
// type : UCPTrieType -> Int32
// valueWidth : UCPTrieValueWidth -> Int32
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function umutablecptrie_buildImmutable(
  trie: Pointer;   // UMutableCPTrie* in/out
  type: Integer;   // UCPTrieType
  valueWidth: Integer;   // UCPTrieValueWidth
  pErrorCode: Pointer   // UErrorCode* in/out
): Pointer; cdecl;
  external 'icu.dll' name 'umutablecptrie_buildImmutable';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "umutablecptrie_buildImmutable"
  c_umutablecptrie_buildImmutable :: Ptr CIntPtr -> Int32 -> Int32 -> Ptr Int32 -> IO (Ptr ())
-- trie : UMutableCPTrie* in/out -> Ptr CIntPtr
-- type : UCPTrieType -> Int32
-- valueWidth : UCPTrieValueWidth -> Int32
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let umutablecptrie_buildimmutable =
  foreign "umutablecptrie_buildImmutable"
    ((ptr intptr_t) @-> int32_t @-> int32_t @-> (ptr int32_t) @-> returning (ptr void))
(* trie : UMutableCPTrie* in/out -> (ptr intptr_t) *)
(* type : UCPTrieType -> int32_t *)
(* valueWidth : UCPTrieValueWidth -> int32_t *)
(* pErrorCode : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icu (t "icu.dll"))
(cffi:use-foreign-library icu)

(cffi:defcfun ("umutablecptrie_buildImmutable" umutablecptrie-build-immutable :convention :cdecl) :pointer
  (trie :pointer)   ; UMutableCPTrie* in/out
  (type :int32)   ; UCPTrieType
  (value-width :int32)   ; UCPTrieValueWidth
  (p-error-code :pointer))   ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $umutablecptrie_buildImmutable = Win32::API::More->new('icu',
    'LPVOID umutablecptrie_buildImmutable(LPVOID trie, int type, int valueWidth, LPVOID pErrorCode)');
# my $ret = $umutablecptrie_buildImmutable->Call($trie, $type, $valueWidth, $pErrorCode);
# trie : UMutableCPTrie* in/out -> LPVOID
# type : UCPTrieType -> int
# valueWidth : UCPTrieValueWidth -> int
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型