ホーム › Globalization › ubrk_openBinaryRules
ubrk_openBinaryRules
関数バイナリ規則からテキスト分割イテレータを開く。
シグネチャ
// icuuc.dll
#include <windows.h>
UBreakIterator* ubrk_openBinaryRules(
const BYTE* binaryRules,
INT rulesLength,
const WORD* text,
INT textLength,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| binaryRules | BYTE* | in |
| rulesLength | INT | in |
| text | WORD* | in |
| textLength | INT | in |
| status | UErrorCode* | inout |
戻り値の型: UBreakIterator*
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
UBreakIterator* ubrk_openBinaryRules(
const BYTE* binaryRules,
INT rulesLength,
const WORD* text,
INT textLength,
UErrorCode* status
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ubrk_openBinaryRules(
IntPtr binaryRules, // BYTE*
int rulesLength, // INT
ref ushort text, // WORD*
int textLength, // INT
ref int status // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ubrk_openBinaryRules(
binaryRules As IntPtr, ' BYTE*
rulesLength As Integer, ' INT
ByRef text As UShort, ' WORD*
textLength As Integer, ' INT
ByRef status As Integer ' UErrorCode* in/out
) As IntPtr
End Function' binaryRules : BYTE*
' rulesLength : INT
' text : WORD*
' textLength : INT
' status : UErrorCode* in/out
Declare PtrSafe Function ubrk_openBinaryRules Lib "icuuc" ( _
ByVal binaryRules As LongPtr, _
ByVal rulesLength As Long, _
ByRef text As Integer, _
ByVal textLength As Long, _
ByRef status As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ubrk_openBinaryRules = ctypes.cdll.icuuc.ubrk_openBinaryRules
ubrk_openBinaryRules.restype = ctypes.c_void_p
ubrk_openBinaryRules.argtypes = [
ctypes.POINTER(ctypes.c_ubyte), # binaryRules : BYTE*
ctypes.c_int, # rulesLength : INT
ctypes.POINTER(ctypes.c_ushort), # text : WORD*
ctypes.c_int, # textLength : INT
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ubrk_openBinaryRules = Fiddle::Function.new(
lib['ubrk_openBinaryRules'],
[
Fiddle::TYPE_VOIDP, # binaryRules : BYTE*
Fiddle::TYPE_INT, # rulesLength : INT
Fiddle::TYPE_VOIDP, # text : WORD*
Fiddle::TYPE_INT, # textLength : INT
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ubrk_openBinaryRules(
binaryRules: *const u8, // BYTE*
rulesLength: i32, // INT
text: *const u16, // WORD*
textLength: i32, // INT
status: *mut i32 // UErrorCode* in/out
) -> *mut isize;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ubrk_openBinaryRules(IntPtr binaryRules, int rulesLength, ref ushort text, int textLength, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ubrk_openBinaryRules' -Namespace Win32 -PassThru
# $api::ubrk_openBinaryRules(binaryRules, rulesLength, text, textLength, status)#uselib "icuuc.dll"
#func global ubrk_openBinaryRules "ubrk_openBinaryRules" sptr, sptr, sptr, sptr, sptr
; ubrk_openBinaryRules varptr(binaryRules), rulesLength, varptr(text), textLength, status ; 戻り値は stat
; binaryRules : BYTE* -> "sptr"
; rulesLength : INT -> "sptr"
; text : WORD* -> "sptr"
; textLength : INT -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuuc.dll" #cfunc global ubrk_openBinaryRules "ubrk_openBinaryRules" var, int, var, int, int ; res = ubrk_openBinaryRules(binaryRules, rulesLength, text, textLength, status) ; binaryRules : BYTE* -> "var" ; rulesLength : INT -> "int" ; text : WORD* -> "var" ; textLength : INT -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #cfunc global ubrk_openBinaryRules "ubrk_openBinaryRules" sptr, int, sptr, int, int ; res = ubrk_openBinaryRules(varptr(binaryRules), rulesLength, varptr(text), textLength, status) ; binaryRules : BYTE* -> "sptr" ; rulesLength : INT -> "int" ; text : WORD* -> "sptr" ; textLength : INT -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; UBreakIterator* ubrk_openBinaryRules(BYTE* binaryRules, INT rulesLength, WORD* text, INT textLength, UErrorCode* status) #uselib "icuuc.dll" #cfunc global ubrk_openBinaryRules "ubrk_openBinaryRules" var, int, var, int, int ; res = ubrk_openBinaryRules(binaryRules, rulesLength, text, textLength, status) ; binaryRules : BYTE* -> "var" ; rulesLength : INT -> "int" ; text : WORD* -> "var" ; textLength : INT -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; UBreakIterator* ubrk_openBinaryRules(BYTE* binaryRules, INT rulesLength, WORD* text, INT textLength, UErrorCode* status) #uselib "icuuc.dll" #cfunc global ubrk_openBinaryRules "ubrk_openBinaryRules" intptr, int, intptr, int, int ; res = ubrk_openBinaryRules(varptr(binaryRules), rulesLength, varptr(text), textLength, status) ; binaryRules : BYTE* -> "intptr" ; rulesLength : INT -> "int" ; text : WORD* -> "intptr" ; textLength : INT -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procubrk_openBinaryRules = icuuc.NewProc("ubrk_openBinaryRules")
)
// binaryRules (BYTE*), rulesLength (INT), text (WORD*), textLength (INT), status (UErrorCode* in/out)
r1, _, err := procubrk_openBinaryRules.Call(
uintptr(binaryRules),
uintptr(rulesLength),
uintptr(text),
uintptr(textLength),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // UBreakIterator*function ubrk_openBinaryRules(
binaryRules: Pointer; // BYTE*
rulesLength: Integer; // INT
text: Pointer; // WORD*
textLength: Integer; // INT
status: Pointer // UErrorCode* in/out
): Pointer; cdecl;
external 'icuuc.dll' name 'ubrk_openBinaryRules';result := DllCall("icuuc\ubrk_openBinaryRules"
, "Ptr", binaryRules ; BYTE*
, "Int", rulesLength ; INT
, "Ptr", text ; WORD*
, "Int", textLength ; INT
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Ptr") ; return: UBreakIterator*●ubrk_openBinaryRules(binaryRules, rulesLength, text, textLength, status) = DLL("icuuc.dll", "void* ubrk_openBinaryRules(void*, int, void*, int, void*)")
# 呼び出し: ubrk_openBinaryRules(binaryRules, rulesLength, text, textLength, status)
# binaryRules : BYTE* -> "void*"
# rulesLength : INT -> "int"
# text : WORD* -> "void*"
# textLength : INT -> "int"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。