ホーム › Globalization › ucol_getBound
ucol_getBound
関数ソートキーから範囲検索用の境界キーを生成する。
シグネチャ
// icuin.dll
#include <windows.h>
INT ucol_getBound(
const BYTE* source,
INT sourceLength,
UColBoundMode boundType,
DWORD noOfLevels,
BYTE* result,
INT resultLength,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| source | BYTE* | in | 境界キーの基となるソートキーのバイト列。 |
| sourceLength | INT | in | sourceの長さ(バイト数)。-1でNUL終端として扱う。 |
| boundType | UColBoundMode | in | 生成する境界の種類。下限/上限などの境界モードを指定する。 |
| noOfLevels | DWORD | in | 境界生成に含める照合レベル数。 |
| result | BYTE* | inout | 生成された境界キーを書き込む出力バイトバッファ。 |
| resultLength | INT | in | resultバッファの容量(バイト数)。0で必要長を取得する。 |
| status | UErrorCode* | inout | エラーコードへのポインタ。呼び出し前に初期化する必要がある。 |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT ucol_getBound(
const BYTE* source,
INT sourceLength,
UColBoundMode boundType,
DWORD noOfLevels,
BYTE* result,
INT resultLength,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ucol_getBound(
IntPtr source, // BYTE*
int sourceLength, // INT
int boundType, // UColBoundMode
uint noOfLevels, // DWORD
IntPtr result, // BYTE* in/out
int resultLength, // INT
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucol_getBound(
source As IntPtr, ' BYTE*
sourceLength As Integer, ' INT
boundType As Integer, ' UColBoundMode
noOfLevels As UInteger, ' DWORD
result As IntPtr, ' BYTE* in/out
resultLength As Integer, ' INT
ByRef status As Integer ' UErrorCode* in/out
) As Integer
End Function' source : BYTE*
' sourceLength : INT
' boundType : UColBoundMode
' noOfLevels : DWORD
' result : BYTE* in/out
' resultLength : INT
' status : UErrorCode* in/out
Declare PtrSafe Function ucol_getBound Lib "icuin" ( _
ByVal source As LongPtr, _
ByVal sourceLength As Long, _
ByVal boundType As Long, _
ByVal noOfLevels As Long, _
ByVal result As LongPtr, _
ByVal resultLength As Long, _
ByRef status As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucol_getBound = ctypes.cdll.icuin.ucol_getBound
ucol_getBound.restype = ctypes.c_int
ucol_getBound.argtypes = [
ctypes.POINTER(ctypes.c_ubyte), # source : BYTE*
ctypes.c_int, # sourceLength : INT
ctypes.c_int, # boundType : UColBoundMode
wintypes.DWORD, # noOfLevels : DWORD
ctypes.POINTER(ctypes.c_ubyte), # result : BYTE* in/out
ctypes.c_int, # resultLength : INT
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
ucol_getBound = Fiddle::Function.new(
lib['ucol_getBound'],
[
Fiddle::TYPE_VOIDP, # source : BYTE*
Fiddle::TYPE_INT, # sourceLength : INT
Fiddle::TYPE_INT, # boundType : UColBoundMode
-Fiddle::TYPE_INT, # noOfLevels : DWORD
Fiddle::TYPE_VOIDP, # result : BYTE* in/out
Fiddle::TYPE_INT, # resultLength : INT
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn ucol_getBound(
source: *const u8, // BYTE*
sourceLength: i32, // INT
boundType: i32, // UColBoundMode
noOfLevels: u32, // DWORD
result: *mut u8, // BYTE* in/out
resultLength: i32, // INT
status: *mut i32 // UErrorCode* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ucol_getBound(IntPtr source, int sourceLength, int boundType, uint noOfLevels, IntPtr result, int resultLength, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucol_getBound' -Namespace Win32 -PassThru
# $api::ucol_getBound(source, sourceLength, boundType, noOfLevels, result, resultLength, status)#uselib "icuin.dll"
#func global ucol_getBound "ucol_getBound" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ucol_getBound varptr(source), sourceLength, boundType, noOfLevels, varptr(result), resultLength, varptr(status) ; 戻り値は stat
; source : BYTE* -> "sptr"
; sourceLength : INT -> "sptr"
; boundType : UColBoundMode -> "sptr"
; noOfLevels : DWORD -> "sptr"
; result : BYTE* in/out -> "sptr"
; resultLength : INT -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global ucol_getBound "ucol_getBound" var, int, int, int, var, int, var ; res = ucol_getBound(source, sourceLength, boundType, noOfLevels, result, resultLength, status) ; source : BYTE* -> "var" ; sourceLength : INT -> "int" ; boundType : UColBoundMode -> "int" ; noOfLevels : DWORD -> "int" ; result : BYTE* in/out -> "var" ; resultLength : INT -> "int" ; status : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global ucol_getBound "ucol_getBound" sptr, int, int, int, sptr, int, sptr ; res = ucol_getBound(varptr(source), sourceLength, boundType, noOfLevels, varptr(result), resultLength, varptr(status)) ; source : BYTE* -> "sptr" ; sourceLength : INT -> "int" ; boundType : UColBoundMode -> "int" ; noOfLevels : DWORD -> "int" ; result : BYTE* in/out -> "sptr" ; resultLength : INT -> "int" ; status : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT ucol_getBound(BYTE* source, INT sourceLength, UColBoundMode boundType, DWORD noOfLevels, BYTE* result, INT resultLength, UErrorCode* status) #uselib "icuin.dll" #cfunc global ucol_getBound "ucol_getBound" var, int, int, int, var, int, var ; res = ucol_getBound(source, sourceLength, boundType, noOfLevels, result, resultLength, status) ; source : BYTE* -> "var" ; sourceLength : INT -> "int" ; boundType : UColBoundMode -> "int" ; noOfLevels : DWORD -> "int" ; result : BYTE* in/out -> "var" ; resultLength : INT -> "int" ; status : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT ucol_getBound(BYTE* source, INT sourceLength, UColBoundMode boundType, DWORD noOfLevels, BYTE* result, INT resultLength, UErrorCode* status) #uselib "icuin.dll" #cfunc global ucol_getBound "ucol_getBound" intptr, int, int, int, intptr, int, intptr ; res = ucol_getBound(varptr(source), sourceLength, boundType, noOfLevels, varptr(result), resultLength, varptr(status)) ; source : BYTE* -> "intptr" ; sourceLength : INT -> "int" ; boundType : UColBoundMode -> "int" ; noOfLevels : DWORD -> "int" ; result : BYTE* in/out -> "intptr" ; resultLength : INT -> "int" ; status : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procucol_getBound = icuin.NewProc("ucol_getBound")
)
// source (BYTE*), sourceLength (INT), boundType (UColBoundMode), noOfLevels (DWORD), result (BYTE* in/out), resultLength (INT), status (UErrorCode* in/out)
r1, _, err := procucol_getBound.Call(
uintptr(source),
uintptr(sourceLength),
uintptr(boundType),
uintptr(noOfLevels),
uintptr(result),
uintptr(resultLength),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ucol_getBound(
source: Pointer; // BYTE*
sourceLength: Integer; // INT
boundType: Integer; // UColBoundMode
noOfLevels: DWORD; // DWORD
result: Pointer; // BYTE* in/out
resultLength: Integer; // INT
status: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'ucol_getBound';result := DllCall("icuin\ucol_getBound"
, "Ptr", source ; BYTE*
, "Int", sourceLength ; INT
, "Int", boundType ; UColBoundMode
, "UInt", noOfLevels ; DWORD
, "Ptr", result ; BYTE* in/out
, "Int", resultLength ; INT
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●ucol_getBound(source, sourceLength, boundType, noOfLevels, result, resultLength, status) = DLL("icuin.dll", "int ucol_getBound(void*, int, int, dword, void*, int, void*)")
# 呼び出し: ucol_getBound(source, sourceLength, boundType, noOfLevels, result, resultLength, status)
# source : BYTE* -> "void*"
# sourceLength : INT -> "int"
# boundType : UColBoundMode -> "int"
# noOfLevels : DWORD -> "dword"
# result : BYTE* in/out -> "void*"
# resultLength : INT -> "int"
# status : 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 "icuin" fn ucol_getBound(
source: [*c]u8, // BYTE*
sourceLength: i32, // INT
boundType: i32, // UColBoundMode
noOfLevels: u32, // DWORD
result: [*c]u8, // BYTE* in/out
resultLength: i32, // INT
status: [*c]i32 // UErrorCode* in/out
) callconv(.c) i32;proc ucol_getBound(
source: ptr uint8, # BYTE*
sourceLength: int32, # INT
boundType: int32, # UColBoundMode
noOfLevels: uint32, # DWORD
result: ptr uint8, # BYTE* in/out
resultLength: int32, # INT
status: ptr int32 # UErrorCode* in/out
): int32 {.importc: "ucol_getBound", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
int ucol_getBound(
ubyte* source, // BYTE*
int sourceLength, // INT
int boundType, // UColBoundMode
uint noOfLevels, // DWORD
ubyte* result, // BYTE* in/out
int resultLength, // INT
int* status // UErrorCode* in/out
);ccall((:ucol_getBound, "icuin.dll"), Int32,
(Ptr{UInt8}, Int32, Int32, UInt32, Ptr{UInt8}, Int32, Ptr{Int32}),
source, sourceLength, boundType, noOfLevels, result, resultLength, status)
# source : BYTE* -> Ptr{UInt8}
# sourceLength : INT -> Int32
# boundType : UColBoundMode -> Int32
# noOfLevels : DWORD -> UInt32
# result : BYTE* in/out -> Ptr{UInt8}
# resultLength : INT -> Int32
# status : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
int32_t ucol_getBound(
uint8_t* source,
int32_t sourceLength,
int32_t boundType,
uint32_t noOfLevels,
uint8_t* result,
int32_t resultLength,
int32_t* status);
]]
local icuin = ffi.load("icuin")
-- icuin.ucol_getBound(source, sourceLength, boundType, noOfLevels, result, resultLength, status)
-- source : BYTE*
-- sourceLength : INT
-- boundType : UColBoundMode
-- noOfLevels : DWORD
-- result : BYTE* in/out
-- resultLength : INT
-- status : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const ucol_getBound = lib.func('__cdecl', 'ucol_getBound', 'int32_t', ['uint8_t *', 'int32_t', 'int32_t', 'uint32_t', 'uint8_t *', 'int32_t', 'int32_t *']);
// ucol_getBound(source, sourceLength, boundType, noOfLevels, result, resultLength, status)
// source : BYTE* -> 'uint8_t *'
// sourceLength : INT -> 'int32_t'
// boundType : UColBoundMode -> 'int32_t'
// noOfLevels : DWORD -> 'uint32_t'
// result : BYTE* in/out -> 'uint8_t *'
// resultLength : INT -> 'int32_t'
// status : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
ucol_getBound: { parameters: ["pointer", "i32", "i32", "u32", "pointer", "i32", "pointer"], result: "i32" },
});
// lib.symbols.ucol_getBound(source, sourceLength, boundType, noOfLevels, result, resultLength, status)
// source : BYTE* -> "pointer"
// sourceLength : INT -> "i32"
// boundType : UColBoundMode -> "i32"
// noOfLevels : DWORD -> "u32"
// result : BYTE* in/out -> "pointer"
// resultLength : INT -> "i32"
// status : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ucol_getBound(
uint8_t* source,
int32_t sourceLength,
int32_t boundType,
uint32_t noOfLevels,
uint8_t* result,
int32_t resultLength,
int32_t* status);
C, "icuin.dll");
// $ffi->ucol_getBound(source, sourceLength, boundType, noOfLevels, result, resultLength, status);
// source : BYTE*
// sourceLength : INT
// boundType : UColBoundMode
// noOfLevels : DWORD
// result : BYTE* in/out
// resultLength : INT
// status : 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 Icuin extends Library {
Icuin INSTANCE = Native.load("icuin", Icuin.class);
int ucol_getBound(
byte[] source, // BYTE*
int sourceLength, // INT
int boundType, // UColBoundMode
int noOfLevels, // DWORD
byte[] result, // BYTE* in/out
int resultLength, // INT
IntByReference status // UErrorCode* in/out
);
}@[Link("icuin")]
lib Libicuin
fun ucol_getBound = ucol_getBound(
source : UInt8*, # BYTE*
sourceLength : Int32, # INT
boundType : Int32, # UColBoundMode
noOfLevels : UInt32, # DWORD
result : UInt8*, # BYTE* in/out
resultLength : Int32, # INT
status : Int32* # UErrorCode* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ucol_getBoundNative = Int32 Function(Pointer<Uint8>, Int32, Int32, Uint32, Pointer<Uint8>, Int32, Pointer<Int32>);
typedef ucol_getBoundDart = int Function(Pointer<Uint8>, int, int, int, Pointer<Uint8>, int, Pointer<Int32>);
final ucol_getBound = DynamicLibrary.open('icuin.dll')
.lookupFunction<ucol_getBoundNative, ucol_getBoundDart>('ucol_getBound');
// source : BYTE* -> Pointer<Uint8>
// sourceLength : INT -> Int32
// boundType : UColBoundMode -> Int32
// noOfLevels : DWORD -> Uint32
// result : BYTE* in/out -> Pointer<Uint8>
// resultLength : INT -> Int32
// status : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ucol_getBound(
source: Pointer; // BYTE*
sourceLength: Integer; // INT
boundType: Integer; // UColBoundMode
noOfLevels: DWORD; // DWORD
result: Pointer; // BYTE* in/out
resultLength: Integer; // INT
status: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'ucol_getBound';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ucol_getBound"
c_ucol_getBound :: Ptr Word8 -> Int32 -> Int32 -> Word32 -> Ptr Word8 -> Int32 -> Ptr Int32 -> IO Int32
-- source : BYTE* -> Ptr Word8
-- sourceLength : INT -> Int32
-- boundType : UColBoundMode -> Int32
-- noOfLevels : DWORD -> Word32
-- result : BYTE* in/out -> Ptr Word8
-- resultLength : INT -> Int32
-- status : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ucol_getbound =
foreign "ucol_getBound"
((ptr uint8_t) @-> int32_t @-> int32_t @-> uint32_t @-> (ptr uint8_t) @-> int32_t @-> (ptr int32_t) @-> returning int32_t)
(* source : BYTE* -> (ptr uint8_t) *)
(* sourceLength : INT -> int32_t *)
(* boundType : UColBoundMode -> int32_t *)
(* noOfLevels : DWORD -> uint32_t *)
(* result : BYTE* in/out -> (ptr uint8_t) *)
(* resultLength : INT -> int32_t *)
(* status : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)
(cffi:defcfun ("ucol_getBound" ucol-get-bound :convention :cdecl) :int32
(source :pointer) ; BYTE*
(source-length :int32) ; INT
(bound-type :int32) ; UColBoundMode
(no-of-levels :uint32) ; DWORD
(result :pointer) ; BYTE* in/out
(result-length :int32) ; INT
(status :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ucol_getBound = Win32::API::More->new('icuin',
'int ucol_getBound(LPVOID source, int sourceLength, int boundType, DWORD noOfLevels, LPVOID result, int resultLength, LPVOID status)');
# my $ret = $ucol_getBound->Call($source, $sourceLength, $boundType, $noOfLevels, $result, $resultLength, $status);
# source : BYTE* -> LPVOID
# sourceLength : INT -> int
# boundType : UColBoundMode -> int
# noOfLevels : DWORD -> DWORD
# result : BYTE* in/out -> LPVOID
# resultLength : INT -> int
# status : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。