ホーム › Globalization › umutablecptrie_getRange
umutablecptrie_getRange
関数可変トライで同一値が連続する範囲を取得する。
シグネチャ
// icu.dll
#include <windows.h>
INT umutablecptrie_getRange(
const UMutableCPTrie* trie,
INT start,
UCPMapRangeOption option,
DWORD surrogateValue,
UCPMapValueFilter* filter,
const void* context,
DWORD* pValue
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| trie | UMutableCPTrie* | in | 走査対象の可変トライへのポインタ。 |
| start | INT | in | 範囲探索を開始するコードポイント。 |
| option | UCPMapRangeOption | in | サロゲート領域の扱いを指定する列挙値(NORMAL/FIXED_LEAD/FIXED_ALL)。 |
| surrogateValue | DWORD | in | option指定時にサロゲート領域へ適用する値。 |
| filter | UCPMapValueFilter* | inout | 値を正規化するコールバック関数。NULL可。 |
| context | void* | in | filterへ渡される任意のユーザーデータ。NULL可。 |
| pValue | DWORD* | inout | 範囲先頭の値を受け取る出力ポインタ。NULL可。 |
戻り値の型: INT
各言語での呼び出し定義
// icu.dll
#include <windows.h>
INT umutablecptrie_getRange(
const UMutableCPTrie* trie,
INT start,
UCPMapRangeOption option,
DWORD surrogateValue,
UCPMapValueFilter* filter,
const void* context,
DWORD* pValue
);[DllImport("icu.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int umutablecptrie_getRange(
ref IntPtr trie, // UMutableCPTrie*
int start, // INT
int option, // UCPMapRangeOption
uint surrogateValue, // DWORD
IntPtr filter, // UCPMapValueFilter* in/out
IntPtr context, // void*
ref uint pValue // DWORD* in/out
);<DllImport("icu.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function umutablecptrie_getRange(
ByRef trie As IntPtr, ' UMutableCPTrie*
start As Integer, ' INT
[option] As Integer, ' UCPMapRangeOption
surrogateValue As UInteger, ' DWORD
filter As IntPtr, ' UCPMapValueFilter* in/out
context As IntPtr, ' void*
ByRef pValue As UInteger ' DWORD* in/out
) As Integer
End Function' trie : UMutableCPTrie*
' start : INT
' option : UCPMapRangeOption
' surrogateValue : DWORD
' filter : UCPMapValueFilter* in/out
' context : void*
' pValue : DWORD* in/out
Declare PtrSafe Function umutablecptrie_getRange Lib "icu" ( _
ByRef trie As LongPtr, _
ByVal start As Long, _
ByVal option As Long, _
ByVal surrogateValue As Long, _
ByVal filter As LongPtr, _
ByVal context As LongPtr, _
ByRef pValue As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
umutablecptrie_getRange = ctypes.cdll.icu.umutablecptrie_getRange
umutablecptrie_getRange.restype = ctypes.c_int
umutablecptrie_getRange.argtypes = [
ctypes.c_void_p, # trie : UMutableCPTrie*
ctypes.c_int, # start : INT
ctypes.c_int, # option : UCPMapRangeOption
wintypes.DWORD, # surrogateValue : DWORD
ctypes.c_void_p, # filter : UCPMapValueFilter* in/out
ctypes.POINTER(None), # context : void*
ctypes.POINTER(wintypes.DWORD), # pValue : DWORD* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icu.dll')
umutablecptrie_getRange = Fiddle::Function.new(
lib['umutablecptrie_getRange'],
[
Fiddle::TYPE_VOIDP, # trie : UMutableCPTrie*
Fiddle::TYPE_INT, # start : INT
Fiddle::TYPE_INT, # option : UCPMapRangeOption
-Fiddle::TYPE_INT, # surrogateValue : DWORD
Fiddle::TYPE_VOIDP, # filter : UCPMapValueFilter* in/out
Fiddle::TYPE_VOIDP, # context : void*
Fiddle::TYPE_VOIDP, # pValue : DWORD* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icu")]
extern "C" {
fn umutablecptrie_getRange(
trie: *const isize, // UMutableCPTrie*
start: i32, // INT
option: i32, // UCPMapRangeOption
surrogateValue: u32, // DWORD
filter: *mut *const core::ffi::c_void, // UCPMapValueFilter* in/out
context: *const (), // void*
pValue: *mut u32 // DWORD* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icu.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int umutablecptrie_getRange(ref IntPtr trie, int start, int option, uint surrogateValue, IntPtr filter, IntPtr context, ref uint pValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icu_umutablecptrie_getRange' -Namespace Win32 -PassThru
# $api::umutablecptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue)#uselib "icu.dll"
#func global umutablecptrie_getRange "umutablecptrie_getRange" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; umutablecptrie_getRange varptr(trie), start, option, surrogateValue, filter, context, varptr(pValue) ; 戻り値は stat
; trie : UMutableCPTrie* -> "sptr"
; start : INT -> "sptr"
; option : UCPMapRangeOption -> "sptr"
; surrogateValue : DWORD -> "sptr"
; filter : UCPMapValueFilter* in/out -> "sptr"
; context : void* -> "sptr"
; pValue : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icu.dll" #cfunc global umutablecptrie_getRange "umutablecptrie_getRange" var, int, int, int, sptr, sptr, var ; res = umutablecptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue) ; trie : UMutableCPTrie* -> "var" ; start : INT -> "int" ; option : UCPMapRangeOption -> "int" ; surrogateValue : DWORD -> "int" ; filter : UCPMapValueFilter* in/out -> "sptr" ; context : void* -> "sptr" ; pValue : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icu.dll" #cfunc global umutablecptrie_getRange "umutablecptrie_getRange" sptr, int, int, int, sptr, sptr, sptr ; res = umutablecptrie_getRange(varptr(trie), start, option, surrogateValue, filter, context, varptr(pValue)) ; trie : UMutableCPTrie* -> "sptr" ; start : INT -> "int" ; option : UCPMapRangeOption -> "int" ; surrogateValue : DWORD -> "int" ; filter : UCPMapValueFilter* in/out -> "sptr" ; context : void* -> "sptr" ; pValue : DWORD* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT umutablecptrie_getRange(UMutableCPTrie* trie, INT start, UCPMapRangeOption option, DWORD surrogateValue, UCPMapValueFilter* filter, void* context, DWORD* pValue) #uselib "icu.dll" #cfunc global umutablecptrie_getRange "umutablecptrie_getRange" var, int, int, int, intptr, intptr, var ; res = umutablecptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue) ; trie : UMutableCPTrie* -> "var" ; start : INT -> "int" ; option : UCPMapRangeOption -> "int" ; surrogateValue : DWORD -> "int" ; filter : UCPMapValueFilter* in/out -> "intptr" ; context : void* -> "intptr" ; pValue : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT umutablecptrie_getRange(UMutableCPTrie* trie, INT start, UCPMapRangeOption option, DWORD surrogateValue, UCPMapValueFilter* filter, void* context, DWORD* pValue) #uselib "icu.dll" #cfunc global umutablecptrie_getRange "umutablecptrie_getRange" intptr, int, int, int, intptr, intptr, intptr ; res = umutablecptrie_getRange(varptr(trie), start, option, surrogateValue, filter, context, varptr(pValue)) ; trie : UMutableCPTrie* -> "intptr" ; start : INT -> "int" ; option : UCPMapRangeOption -> "int" ; surrogateValue : DWORD -> "int" ; filter : UCPMapValueFilter* in/out -> "intptr" ; context : void* -> "intptr" ; pValue : DWORD* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icu = windows.NewLazySystemDLL("icu.dll")
procumutablecptrie_getRange = icu.NewProc("umutablecptrie_getRange")
)
// trie (UMutableCPTrie*), start (INT), option (UCPMapRangeOption), surrogateValue (DWORD), filter (UCPMapValueFilter* in/out), context (void*), pValue (DWORD* in/out)
r1, _, err := procumutablecptrie_getRange.Call(
uintptr(trie),
uintptr(start),
uintptr(option),
uintptr(surrogateValue),
uintptr(filter),
uintptr(context),
uintptr(pValue),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction umutablecptrie_getRange(
trie: Pointer; // UMutableCPTrie*
start: Integer; // INT
option: Integer; // UCPMapRangeOption
surrogateValue: DWORD; // DWORD
filter: Pointer; // UCPMapValueFilter* in/out
context: Pointer; // void*
pValue: Pointer // DWORD* in/out
): Integer; cdecl;
external 'icu.dll' name 'umutablecptrie_getRange';result := DllCall("icu\umutablecptrie_getRange"
, "Ptr", trie ; UMutableCPTrie*
, "Int", start ; INT
, "Int", option ; UCPMapRangeOption
, "UInt", surrogateValue ; DWORD
, "Ptr", filter ; UCPMapValueFilter* in/out
, "Ptr", context ; void*
, "Ptr", pValue ; DWORD* in/out
, "Cdecl Int") ; return: INT●umutablecptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue) = DLL("icu.dll", "int umutablecptrie_getRange(void*, int, int, dword, void*, void*, void*)")
# 呼び出し: umutablecptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue)
# trie : UMutableCPTrie* -> "void*"
# start : INT -> "int"
# option : UCPMapRangeOption -> "int"
# surrogateValue : DWORD -> "dword"
# filter : UCPMapValueFilter* in/out -> "void*"
# context : void* -> "void*"
# pValue : DWORD* 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_getRange(
trie: [*c]isize, // UMutableCPTrie*
start: i32, // INT
option: i32, // UCPMapRangeOption
surrogateValue: u32, // DWORD
filter: ?*anyopaque, // UCPMapValueFilter* in/out
context: ?*anyopaque, // void*
pValue: [*c]u32 // DWORD* in/out
) callconv(.c) i32;proc umutablecptrie_getRange(
trie: ptr int, # UMutableCPTrie*
start: int32, # INT
option: int32, # UCPMapRangeOption
surrogateValue: uint32, # DWORD
filter: pointer, # UCPMapValueFilter* in/out
context: pointer, # void*
pValue: ptr uint32 # DWORD* in/out
): int32 {.importc: "umutablecptrie_getRange", cdecl, dynlib: "icu.dll".}pragma(lib, "icu");
extern(C)
int umutablecptrie_getRange(
ptrdiff_t* trie, // UMutableCPTrie*
int start, // INT
int option, // UCPMapRangeOption
uint surrogateValue, // DWORD
void* filter, // UCPMapValueFilter* in/out
void* context, // void*
uint* pValue // DWORD* in/out
);ccall((:umutablecptrie_getRange, "icu.dll"), Int32,
(Ptr{Int}, Int32, Int32, UInt32, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{UInt32}),
trie, start, option, surrogateValue, filter, context, pValue)
# trie : UMutableCPTrie* -> Ptr{Int}
# start : INT -> Int32
# option : UCPMapRangeOption -> Int32
# surrogateValue : DWORD -> UInt32
# filter : UCPMapValueFilter* in/out -> Ptr{Cvoid}
# context : void* -> Ptr{Cvoid}
# pValue : DWORD* in/out -> Ptr{UInt32}local ffi = require("ffi")
ffi.cdef[[
int32_t umutablecptrie_getRange(
intptr_t* trie,
int32_t start,
int32_t option,
uint32_t surrogateValue,
void* filter,
void* context,
uint32_t* pValue);
]]
local icu = ffi.load("icu")
-- icu.umutablecptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue)
-- trie : UMutableCPTrie*
-- start : INT
-- option : UCPMapRangeOption
-- surrogateValue : DWORD
-- filter : UCPMapValueFilter* in/out
-- context : void*
-- pValue : DWORD* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icu.dll');
const umutablecptrie_getRange = lib.func('__cdecl', 'umutablecptrie_getRange', 'int32_t', ['intptr_t *', 'int32_t', 'int32_t', 'uint32_t', 'void *', 'void *', 'uint32_t *']);
// umutablecptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue)
// trie : UMutableCPTrie* -> 'intptr_t *'
// start : INT -> 'int32_t'
// option : UCPMapRangeOption -> 'int32_t'
// surrogateValue : DWORD -> 'uint32_t'
// filter : UCPMapValueFilter* in/out -> 'void *'
// context : void* -> 'void *'
// pValue : DWORD* in/out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。const lib = Deno.dlopen("icu.dll", {
umutablecptrie_getRange: { parameters: ["pointer", "i32", "i32", "u32", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.umutablecptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue)
// trie : UMutableCPTrie* -> "pointer"
// start : INT -> "i32"
// option : UCPMapRangeOption -> "i32"
// surrogateValue : DWORD -> "u32"
// filter : UCPMapValueFilter* in/out -> "pointer"
// context : void* -> "pointer"
// pValue : DWORD* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t umutablecptrie_getRange(
intptr_t* trie,
int32_t start,
int32_t option,
uint32_t surrogateValue,
void* filter,
void* context,
uint32_t* pValue);
C, "icu.dll");
// $ffi->umutablecptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue);
// trie : UMutableCPTrie*
// start : INT
// option : UCPMapRangeOption
// surrogateValue : DWORD
// filter : UCPMapValueFilter* in/out
// context : void*
// pValue : DWORD* 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);
int umutablecptrie_getRange(
LongByReference trie, // UMutableCPTrie*
int start, // INT
int option, // UCPMapRangeOption
int surrogateValue, // DWORD
Callback filter, // UCPMapValueFilter* in/out
Pointer context, // void*
IntByReference pValue // DWORD* in/out
);
}@[Link("icu")]
lib Libicu
fun umutablecptrie_getRange = umutablecptrie_getRange(
trie : LibC::SSizeT*, # UMutableCPTrie*
start : Int32, # INT
option : Int32, # UCPMapRangeOption
surrogateValue : UInt32, # DWORD
filter : Void*, # UCPMapValueFilter* in/out
context : Void*, # void*
pValue : UInt32* # DWORD* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef umutablecptrie_getRangeNative = Int32 Function(Pointer<IntPtr>, Int32, Int32, Uint32, Pointer<Void>, Pointer<Void>, Pointer<Uint32>);
typedef umutablecptrie_getRangeDart = int Function(Pointer<IntPtr>, int, int, int, Pointer<Void>, Pointer<Void>, Pointer<Uint32>);
final umutablecptrie_getRange = DynamicLibrary.open('icu.dll')
.lookupFunction<umutablecptrie_getRangeNative, umutablecptrie_getRangeDart>('umutablecptrie_getRange');
// trie : UMutableCPTrie* -> Pointer<IntPtr>
// start : INT -> Int32
// option : UCPMapRangeOption -> Int32
// surrogateValue : DWORD -> Uint32
// filter : UCPMapValueFilter* in/out -> Pointer<Void>
// context : void* -> Pointer<Void>
// pValue : DWORD* in/out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function umutablecptrie_getRange(
trie: Pointer; // UMutableCPTrie*
start: Integer; // INT
option: Integer; // UCPMapRangeOption
surrogateValue: DWORD; // DWORD
filter: Pointer; // UCPMapValueFilter* in/out
context: Pointer; // void*
pValue: Pointer // DWORD* in/out
): Integer; cdecl;
external 'icu.dll' name 'umutablecptrie_getRange';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "umutablecptrie_getRange"
c_umutablecptrie_getRange :: Ptr CIntPtr -> Int32 -> Int32 -> Word32 -> Ptr () -> Ptr () -> Ptr Word32 -> IO Int32
-- trie : UMutableCPTrie* -> Ptr CIntPtr
-- start : INT -> Int32
-- option : UCPMapRangeOption -> Int32
-- surrogateValue : DWORD -> Word32
-- filter : UCPMapValueFilter* in/out -> Ptr ()
-- context : void* -> Ptr ()
-- pValue : DWORD* in/out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let umutablecptrie_getrange =
foreign "umutablecptrie_getRange"
((ptr intptr_t) @-> int32_t @-> int32_t @-> uint32_t @-> (ptr void) @-> (ptr void) @-> (ptr uint32_t) @-> returning int32_t)
(* trie : UMutableCPTrie* -> (ptr intptr_t) *)
(* start : INT -> int32_t *)
(* option : UCPMapRangeOption -> int32_t *)
(* surrogateValue : DWORD -> uint32_t *)
(* filter : UCPMapValueFilter* in/out -> (ptr void) *)
(* context : void* -> (ptr void) *)
(* pValue : DWORD* in/out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icu (t "icu.dll"))
(cffi:use-foreign-library icu)
(cffi:defcfun ("umutablecptrie_getRange" umutablecptrie-get-range :convention :cdecl) :int32
(trie :pointer) ; UMutableCPTrie*
(start :int32) ; INT
(option :int32) ; UCPMapRangeOption
(surrogate-value :uint32) ; DWORD
(filter :pointer) ; UCPMapValueFilter* in/out
(context :pointer) ; void*
(p-value :pointer)) ; DWORD* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $umutablecptrie_getRange = Win32::API::More->new('icu',
'int umutablecptrie_getRange(LPVOID trie, int start, int option, DWORD surrogateValue, LPVOID filter, LPVOID context, LPVOID pValue)');
# my $ret = $umutablecptrie_getRange->Call($trie, $start, $option, $surrogateValue, $filter, $context, $pValue);
# trie : UMutableCPTrie* -> LPVOID
# start : INT -> int
# option : UCPMapRangeOption -> int
# surrogateValue : DWORD -> DWORD
# filter : UCPMapValueFilter* in/out -> LPVOID
# context : void* -> LPVOID
# pValue : DWORD* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。