ホーム › Globalization › ucpmap_getRange
ucpmap_getRange
関数コードポイントマップで同一値が連続する範囲を取得する。
シグネチャ
// icu.dll
#include <windows.h>
INT ucpmap_getRange(
const UCPMap* map,
INT start,
UCPMapRangeOption option,
DWORD surrogateValue,
UCPMapValueFilter* filter,
const void* context,
DWORD* pValue
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| map | UCPMap* | in | 走査対象のUCPMap(コードポイント→値のマップ)へのポインタ。 |
| 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 ucpmap_getRange(
const UCPMap* map,
INT start,
UCPMapRangeOption option,
DWORD surrogateValue,
UCPMapValueFilter* filter,
const void* context,
DWORD* pValue
);[DllImport("icu.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ucpmap_getRange(
ref IntPtr map, // UCPMap*
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 ucpmap_getRange(
ByRef map As IntPtr, ' UCPMap*
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' map : UCPMap*
' start : INT
' option : UCPMapRangeOption
' surrogateValue : DWORD
' filter : UCPMapValueFilter* in/out
' context : void*
' pValue : DWORD* in/out
Declare PtrSafe Function ucpmap_getRange Lib "icu" ( _
ByRef map 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
ucpmap_getRange = ctypes.cdll.icu.ucpmap_getRange
ucpmap_getRange.restype = ctypes.c_int
ucpmap_getRange.argtypes = [
ctypes.c_void_p, # map : UCPMap*
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')
ucpmap_getRange = Fiddle::Function.new(
lib['ucpmap_getRange'],
[
Fiddle::TYPE_VOIDP, # map : UCPMap*
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 ucpmap_getRange(
map: *const isize, // UCPMap*
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 ucpmap_getRange(ref IntPtr map, int start, int option, uint surrogateValue, IntPtr filter, IntPtr context, ref uint pValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icu_ucpmap_getRange' -Namespace Win32 -PassThru
# $api::ucpmap_getRange(map, start, option, surrogateValue, filter, context, pValue)#uselib "icu.dll"
#func global ucpmap_getRange "ucpmap_getRange" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ucpmap_getRange varptr(map), start, option, surrogateValue, filter, context, varptr(pValue) ; 戻り値は stat
; map : UCPMap* -> "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 ucpmap_getRange "ucpmap_getRange" var, int, int, int, sptr, sptr, var ; res = ucpmap_getRange(map, start, option, surrogateValue, filter, context, pValue) ; map : UCPMap* -> "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 ucpmap_getRange "ucpmap_getRange" sptr, int, int, int, sptr, sptr, sptr ; res = ucpmap_getRange(varptr(map), start, option, surrogateValue, filter, context, varptr(pValue)) ; map : UCPMap* -> "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 ucpmap_getRange(UCPMap* map, INT start, UCPMapRangeOption option, DWORD surrogateValue, UCPMapValueFilter* filter, void* context, DWORD* pValue) #uselib "icu.dll" #cfunc global ucpmap_getRange "ucpmap_getRange" var, int, int, int, intptr, intptr, var ; res = ucpmap_getRange(map, start, option, surrogateValue, filter, context, pValue) ; map : UCPMap* -> "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 ucpmap_getRange(UCPMap* map, INT start, UCPMapRangeOption option, DWORD surrogateValue, UCPMapValueFilter* filter, void* context, DWORD* pValue) #uselib "icu.dll" #cfunc global ucpmap_getRange "ucpmap_getRange" intptr, int, int, int, intptr, intptr, intptr ; res = ucpmap_getRange(varptr(map), start, option, surrogateValue, filter, context, varptr(pValue)) ; map : UCPMap* -> "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")
procucpmap_getRange = icu.NewProc("ucpmap_getRange")
)
// map (UCPMap*), start (INT), option (UCPMapRangeOption), surrogateValue (DWORD), filter (UCPMapValueFilter* in/out), context (void*), pValue (DWORD* in/out)
r1, _, err := procucpmap_getRange.Call(
uintptr(map),
uintptr(start),
uintptr(option),
uintptr(surrogateValue),
uintptr(filter),
uintptr(context),
uintptr(pValue),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ucpmap_getRange(
map: Pointer; // UCPMap*
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 'ucpmap_getRange';result := DllCall("icu\ucpmap_getRange"
, "Ptr", map ; UCPMap*
, "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●ucpmap_getRange(map, start, option, surrogateValue, filter, context, pValue) = DLL("icu.dll", "int ucpmap_getRange(void*, int, int, dword, void*, void*, void*)")
# 呼び出し: ucpmap_getRange(map, start, option, surrogateValue, filter, context, pValue)
# map : UCPMap* -> "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 ucpmap_getRange(
map: [*c]isize, // UCPMap*
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 ucpmap_getRange(
map: ptr int, # UCPMap*
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: "ucpmap_getRange", cdecl, dynlib: "icu.dll".}pragma(lib, "icu");
extern(C)
int ucpmap_getRange(
ptrdiff_t* map, // UCPMap*
int start, // INT
int option, // UCPMapRangeOption
uint surrogateValue, // DWORD
void* filter, // UCPMapValueFilter* in/out
void* context, // void*
uint* pValue // DWORD* in/out
);ccall((:ucpmap_getRange, "icu.dll"), Int32,
(Ptr{Int}, Int32, Int32, UInt32, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{UInt32}),
map, start, option, surrogateValue, filter, context, pValue)
# map : UCPMap* -> 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 ucpmap_getRange(
intptr_t* map,
int32_t start,
int32_t option,
uint32_t surrogateValue,
void* filter,
void* context,
uint32_t* pValue);
]]
local icu = ffi.load("icu")
-- icu.ucpmap_getRange(map, start, option, surrogateValue, filter, context, pValue)
-- map : UCPMap*
-- 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 ucpmap_getRange = lib.func('__cdecl', 'ucpmap_getRange', 'int32_t', ['intptr_t *', 'int32_t', 'int32_t', 'uint32_t', 'void *', 'void *', 'uint32_t *']);
// ucpmap_getRange(map, start, option, surrogateValue, filter, context, pValue)
// map : UCPMap* -> '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", {
ucpmap_getRange: { parameters: ["pointer", "i32", "i32", "u32", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.ucpmap_getRange(map, start, option, surrogateValue, filter, context, pValue)
// map : UCPMap* -> "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 ucpmap_getRange(
intptr_t* map,
int32_t start,
int32_t option,
uint32_t surrogateValue,
void* filter,
void* context,
uint32_t* pValue);
C, "icu.dll");
// $ffi->ucpmap_getRange(map, start, option, surrogateValue, filter, context, pValue);
// map : UCPMap*
// 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 ucpmap_getRange(
LongByReference map, // UCPMap*
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 ucpmap_getRange = ucpmap_getRange(
map : LibC::SSizeT*, # UCPMap*
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 ucpmap_getRangeNative = Int32 Function(Pointer<IntPtr>, Int32, Int32, Uint32, Pointer<Void>, Pointer<Void>, Pointer<Uint32>);
typedef ucpmap_getRangeDart = int Function(Pointer<IntPtr>, int, int, int, Pointer<Void>, Pointer<Void>, Pointer<Uint32>);
final ucpmap_getRange = DynamicLibrary.open('icu.dll')
.lookupFunction<ucpmap_getRangeNative, ucpmap_getRangeDart>('ucpmap_getRange');
// map : UCPMap* -> 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 ucpmap_getRange(
map: Pointer; // UCPMap*
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 'ucpmap_getRange';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ucpmap_getRange"
c_ucpmap_getRange :: Ptr CIntPtr -> Int32 -> Int32 -> Word32 -> Ptr () -> Ptr () -> Ptr Word32 -> IO Int32
-- map : UCPMap* -> 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 ucpmap_getrange =
foreign "ucpmap_getRange"
((ptr intptr_t) @-> int32_t @-> int32_t @-> uint32_t @-> (ptr void) @-> (ptr void) @-> (ptr uint32_t) @-> returning int32_t)
(* map : UCPMap* -> (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 ("ucpmap_getRange" ucpmap-get-range :convention :cdecl) :int32
(map :pointer) ; UCPMap*
(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 $ucpmap_getRange = Win32::API::More->new('icu',
'int ucpmap_getRange(LPVOID map, int start, int option, DWORD surrogateValue, LPVOID filter, LPVOID context, LPVOID pValue)');
# my $ret = $ucpmap_getRange->Call($map, $start, $option, $surrogateValue, $filter, $context, $pValue);
# map : UCPMap* -> 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 を使用してください。