Win32 API 日本語リファレンス
ホームGlobalization › ubrk_openRules

ubrk_openRules

関数
カスタム規則からテキスト分割イテレータを開く。
DLLicuuc.dll呼出規約cdecl

シグネチャ

// icuuc.dll
#include <windows.h>

UBreakIterator* ubrk_openRules(
    const WORD* rules,
    INT rulesLength,
    const WORD* text,
    INT textLength,
    UParseError* parseErr,
    UErrorCode* status
);

パラメーター

名前方向
rulesWORD*in
rulesLengthINTin
textWORD*in
textLengthINTin
parseErrUParseError*inout
statusUErrorCode*inout

戻り値の型: UBreakIterator*

各言語での呼び出し定義

// icuuc.dll
#include <windows.h>

UBreakIterator* ubrk_openRules(
    const WORD* rules,
    INT rulesLength,
    const WORD* text,
    INT textLength,
    UParseError* parseErr,
    UErrorCode* status
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ubrk_openRules(
    ref ushort rules,   // WORD*
    int rulesLength,   // INT
    ref ushort text,   // WORD*
    int textLength,   // INT
    IntPtr parseErr,   // UParseError* in/out
    ref int status   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ubrk_openRules(
    ByRef rules As UShort,   ' WORD*
    rulesLength As Integer,   ' INT
    ByRef text As UShort,   ' WORD*
    textLength As Integer,   ' INT
    parseErr As IntPtr,   ' UParseError* in/out
    ByRef status As Integer   ' UErrorCode* in/out
) As IntPtr
End Function
' rules : WORD*
' rulesLength : INT
' text : WORD*
' textLength : INT
' parseErr : UParseError* in/out
' status : UErrorCode* in/out
Declare PtrSafe Function ubrk_openRules Lib "icuuc" ( _
    ByRef rules As Integer, _
    ByVal rulesLength As Long, _
    ByRef text As Integer, _
    ByVal textLength As Long, _
    ByVal parseErr As LongPtr, _
    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_openRules = ctypes.cdll.icuuc.ubrk_openRules
ubrk_openRules.restype = ctypes.c_void_p
ubrk_openRules.argtypes = [
    ctypes.POINTER(ctypes.c_ushort),  # rules : WORD*
    ctypes.c_int,  # rulesLength : INT
    ctypes.POINTER(ctypes.c_ushort),  # text : WORD*
    ctypes.c_int,  # textLength : INT
    ctypes.c_void_p,  # parseErr : UParseError* in/out
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
ubrk_openRules = Fiddle::Function.new(
  lib['ubrk_openRules'],
  [
    Fiddle::TYPE_VOIDP,  # rules : WORD*
    Fiddle::TYPE_INT,  # rulesLength : INT
    Fiddle::TYPE_VOIDP,  # text : WORD*
    Fiddle::TYPE_INT,  # textLength : INT
    Fiddle::TYPE_VOIDP,  # parseErr : UParseError* in/out
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn ubrk_openRules(
        rules: *const u16,  // WORD*
        rulesLength: i32,  // INT
        text: *const u16,  // WORD*
        textLength: i32,  // INT
        parseErr: *mut UParseError,  // UParseError* in/out
        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_openRules(ref ushort rules, int rulesLength, ref ushort text, int textLength, IntPtr parseErr, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ubrk_openRules' -Namespace Win32 -PassThru
# $api::ubrk_openRules(rules, rulesLength, text, textLength, parseErr, status)
#uselib "icuuc.dll"
#func global ubrk_openRules "ubrk_openRules" sptr, sptr, sptr, sptr, sptr, sptr
; ubrk_openRules varptr(rules), rulesLength, varptr(text), textLength, varptr(parseErr), status   ; 戻り値は stat
; rules : WORD* -> "sptr"
; rulesLength : INT -> "sptr"
; text : WORD* -> "sptr"
; textLength : INT -> "sptr"
; parseErr : UParseError* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global ubrk_openRules "ubrk_openRules" var, int, var, int, var, int
; res = ubrk_openRules(rules, rulesLength, text, textLength, parseErr, status)
; rules : WORD* -> "var"
; rulesLength : INT -> "int"
; text : WORD* -> "var"
; textLength : INT -> "int"
; parseErr : UParseError* in/out -> "var"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; UBreakIterator* ubrk_openRules(WORD* rules, INT rulesLength, WORD* text, INT textLength, UParseError* parseErr, UErrorCode* status)
#uselib "icuuc.dll"
#cfunc global ubrk_openRules "ubrk_openRules" var, int, var, int, var, int
; res = ubrk_openRules(rules, rulesLength, text, textLength, parseErr, status)
; rules : WORD* -> "var"
; rulesLength : INT -> "int"
; text : WORD* -> "var"
; textLength : INT -> "int"
; parseErr : UParseError* in/out -> "var"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procubrk_openRules = icuuc.NewProc("ubrk_openRules")
)

// rules (WORD*), rulesLength (INT), text (WORD*), textLength (INT), parseErr (UParseError* in/out), status (UErrorCode* in/out)
r1, _, err := procubrk_openRules.Call(
	uintptr(rules),
	uintptr(rulesLength),
	uintptr(text),
	uintptr(textLength),
	uintptr(parseErr),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // UBreakIterator*
function ubrk_openRules(
  rules: Pointer;   // WORD*
  rulesLength: Integer;   // INT
  text: Pointer;   // WORD*
  textLength: Integer;   // INT
  parseErr: Pointer;   // UParseError* in/out
  status: Pointer   // UErrorCode* in/out
): Pointer; cdecl;
  external 'icuuc.dll' name 'ubrk_openRules';
result := DllCall("icuuc\ubrk_openRules"
    , "Ptr", rules   ; WORD*
    , "Int", rulesLength   ; INT
    , "Ptr", text   ; WORD*
    , "Int", textLength   ; INT
    , "Ptr", parseErr   ; UParseError* in/out
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Ptr")   ; return: UBreakIterator*
●ubrk_openRules(rules, rulesLength, text, textLength, parseErr, status) = DLL("icuuc.dll", "void* ubrk_openRules(void*, int, void*, int, void*, void*)")
# 呼び出し: ubrk_openRules(rules, rulesLength, text, textLength, parseErr, status)
# rules : WORD* -> "void*"
# rulesLength : INT -> "int"
# text : WORD* -> "void*"
# textLength : INT -> "int"
# parseErr : UParseError* in/out -> "void*"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。