ホーム › Globalization › ucptrie_getRange
ucptrie_getRange
関数コードポイントトライで同一値が連続する範囲を取得する。
シグネチャ
// icu.dll
#include <windows.h>
INT ucptrie_getRange(
const UCPTrie* trie,
INT start,
UCPMapRangeOption option,
DWORD surrogateValue,
UCPMapValueFilter* filter,
const void* context,
DWORD* pValue
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| trie | UCPTrie* | 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 ucptrie_getRange(
const UCPTrie* 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 ucptrie_getRange(
IntPtr trie, // UCPTrie*
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 ucptrie_getRange(
trie As IntPtr, ' UCPTrie*
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 : UCPTrie*
' start : INT
' option : UCPMapRangeOption
' surrogateValue : DWORD
' filter : UCPMapValueFilter* in/out
' context : void*
' pValue : DWORD* in/out
Declare PtrSafe Function ucptrie_getRange Lib "icu" ( _
ByVal 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
ucptrie_getRange = ctypes.cdll.icu.ucptrie_getRange
ucptrie_getRange.restype = ctypes.c_int
ucptrie_getRange.argtypes = [
ctypes.c_void_p, # trie : UCPTrie*
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')
ucptrie_getRange = Fiddle::Function.new(
lib['ucptrie_getRange'],
[
Fiddle::TYPE_VOIDP, # trie : UCPTrie*
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 ucptrie_getRange(
trie: *const UCPTrie, // UCPTrie*
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 ucptrie_getRange(IntPtr trie, int start, int option, uint surrogateValue, IntPtr filter, IntPtr context, ref uint pValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icu_ucptrie_getRange' -Namespace Win32 -PassThru
# $api::ucptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue)#uselib "icu.dll"
#func global ucptrie_getRange "ucptrie_getRange" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ucptrie_getRange varptr(trie), start, option, surrogateValue, filter, context, varptr(pValue) ; 戻り値は stat
; trie : UCPTrie* -> "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 ucptrie_getRange "ucptrie_getRange" var, int, int, int, sptr, sptr, var ; res = ucptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue) ; trie : UCPTrie* -> "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 ucptrie_getRange "ucptrie_getRange" sptr, int, int, int, sptr, sptr, sptr ; res = ucptrie_getRange(varptr(trie), start, option, surrogateValue, filter, context, varptr(pValue)) ; trie : UCPTrie* -> "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 ucptrie_getRange(UCPTrie* trie, INT start, UCPMapRangeOption option, DWORD surrogateValue, UCPMapValueFilter* filter, void* context, DWORD* pValue) #uselib "icu.dll" #cfunc global ucptrie_getRange "ucptrie_getRange" var, int, int, int, intptr, intptr, var ; res = ucptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue) ; trie : UCPTrie* -> "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 ucptrie_getRange(UCPTrie* trie, INT start, UCPMapRangeOption option, DWORD surrogateValue, UCPMapValueFilter* filter, void* context, DWORD* pValue) #uselib "icu.dll" #cfunc global ucptrie_getRange "ucptrie_getRange" intptr, int, int, int, intptr, intptr, intptr ; res = ucptrie_getRange(varptr(trie), start, option, surrogateValue, filter, context, varptr(pValue)) ; trie : UCPTrie* -> "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")
procucptrie_getRange = icu.NewProc("ucptrie_getRange")
)
// trie (UCPTrie*), start (INT), option (UCPMapRangeOption), surrogateValue (DWORD), filter (UCPMapValueFilter* in/out), context (void*), pValue (DWORD* in/out)
r1, _, err := procucptrie_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 ucptrie_getRange(
trie: Pointer; // UCPTrie*
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 'ucptrie_getRange';result := DllCall("icu\ucptrie_getRange"
, "Ptr", trie ; UCPTrie*
, "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●ucptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue) = DLL("icu.dll", "int ucptrie_getRange(void*, int, int, dword, void*, void*, void*)")
# 呼び出し: ucptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue)
# trie : UCPTrie* -> "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 ucptrie_getRange(
trie: [*c]UCPTrie, // UCPTrie*
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 ucptrie_getRange(
trie: ptr UCPTrie, # UCPTrie*
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: "ucptrie_getRange", cdecl, dynlib: "icu.dll".}pragma(lib, "icu");
extern(C)
int ucptrie_getRange(
UCPTrie* trie, // UCPTrie*
int start, // INT
int option, // UCPMapRangeOption
uint surrogateValue, // DWORD
void* filter, // UCPMapValueFilter* in/out
void* context, // void*
uint* pValue // DWORD* in/out
);ccall((:ucptrie_getRange, "icu.dll"), Int32,
(Ptr{UCPTrie}, Int32, Int32, UInt32, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{UInt32}),
trie, start, option, surrogateValue, filter, context, pValue)
# trie : UCPTrie* -> Ptr{UCPTrie}
# 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 ucptrie_getRange(
void* trie,
int32_t start,
int32_t option,
uint32_t surrogateValue,
void* filter,
void* context,
uint32_t* pValue);
]]
local icu = ffi.load("icu")
-- icu.ucptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue)
-- trie : UCPTrie*
-- 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 ucptrie_getRange = lib.func('__cdecl', 'ucptrie_getRange', 'int32_t', ['void *', 'int32_t', 'int32_t', 'uint32_t', 'void *', 'void *', 'uint32_t *']);
// ucptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue)
// trie : UCPTrie* -> 'void *'
// 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", {
ucptrie_getRange: { parameters: ["pointer", "i32", "i32", "u32", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.ucptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue)
// trie : UCPTrie* -> "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 ucptrie_getRange(
void* trie,
int32_t start,
int32_t option,
uint32_t surrogateValue,
void* filter,
void* context,
uint32_t* pValue);
C, "icu.dll");
// $ffi->ucptrie_getRange(trie, start, option, surrogateValue, filter, context, pValue);
// trie : UCPTrie*
// 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 ucptrie_getRange(
Pointer trie, // UCPTrie*
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 ucptrie_getRange = ucptrie_getRange(
trie : UCPTrie*, # UCPTrie*
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 ucptrie_getRangeNative = Int32 Function(Pointer<Void>, Int32, Int32, Uint32, Pointer<Void>, Pointer<Void>, Pointer<Uint32>);
typedef ucptrie_getRangeDart = int Function(Pointer<Void>, int, int, int, Pointer<Void>, Pointer<Void>, Pointer<Uint32>);
final ucptrie_getRange = DynamicLibrary.open('icu.dll')
.lookupFunction<ucptrie_getRangeNative, ucptrie_getRangeDart>('ucptrie_getRange');
// trie : UCPTrie* -> Pointer<Void>
// 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 ucptrie_getRange(
trie: Pointer; // UCPTrie*
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 'ucptrie_getRange';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ucptrie_getRange"
c_ucptrie_getRange :: Ptr () -> Int32 -> Int32 -> Word32 -> Ptr () -> Ptr () -> Ptr Word32 -> IO Int32
-- trie : UCPTrie* -> Ptr ()
-- 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 ucptrie_getrange =
foreign "ucptrie_getRange"
((ptr void) @-> int32_t @-> int32_t @-> uint32_t @-> (ptr void) @-> (ptr void) @-> (ptr uint32_t) @-> returning int32_t)
(* trie : UCPTrie* -> (ptr void) *)
(* 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 ("ucptrie_getRange" ucptrie-get-range :convention :cdecl) :int32
(trie :pointer) ; UCPTrie*
(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 $ucptrie_getRange = Win32::API::More->new('icu',
'int ucptrie_getRange(LPVOID trie, int start, int option, DWORD surrogateValue, LPVOID filter, LPVOID context, LPVOID pValue)');
# my $ret = $ucptrie_getRange->Call($trie, $start, $option, $surrogateValue, $filter, $context, $pValue);
# trie : UCPTrie* -> 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 を使用してください。