ホーム › Globalization › ucol_openRules
ucol_openRules
関数カスタム照合規則からコレータを開く。
シグネチャ
// icuin.dll
#include <windows.h>
UCollator* ucol_openRules(
const WORD* rules,
INT rulesLength,
UColAttributeValue normalizationMode,
UColAttributeValue strength,
UParseError* parseError,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| rules | WORD* | in |
| rulesLength | INT | in |
| normalizationMode | UColAttributeValue | in |
| strength | UColAttributeValue | in |
| parseError | UParseError* | inout |
| status | UErrorCode* | inout |
戻り値の型: UCollator*
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
UCollator* ucol_openRules(
const WORD* rules,
INT rulesLength,
UColAttributeValue normalizationMode,
UColAttributeValue strength,
UParseError* parseError,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ucol_openRules(
ref ushort rules, // WORD*
int rulesLength, // INT
int normalizationMode, // UColAttributeValue
int strength, // UColAttributeValue
IntPtr parseError, // UParseError* in/out
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucol_openRules(
ByRef rules As UShort, ' WORD*
rulesLength As Integer, ' INT
normalizationMode As Integer, ' UColAttributeValue
strength As Integer, ' UColAttributeValue
parseError As IntPtr, ' UParseError* in/out
ByRef status As Integer ' UErrorCode* in/out
) As IntPtr
End Function' rules : WORD*
' rulesLength : INT
' normalizationMode : UColAttributeValue
' strength : UColAttributeValue
' parseError : UParseError* in/out
' status : UErrorCode* in/out
Declare PtrSafe Function ucol_openRules Lib "icuin" ( _
ByRef rules As Integer, _
ByVal rulesLength As Long, _
ByVal normalizationMode As Long, _
ByVal strength As Long, _
ByVal parseError 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
ucol_openRules = ctypes.cdll.icuin.ucol_openRules
ucol_openRules.restype = ctypes.c_void_p
ucol_openRules.argtypes = [
ctypes.POINTER(ctypes.c_ushort), # rules : WORD*
ctypes.c_int, # rulesLength : INT
ctypes.c_int, # normalizationMode : UColAttributeValue
ctypes.c_int, # strength : UColAttributeValue
ctypes.c_void_p, # parseError : UParseError* in/out
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
ucol_openRules = Fiddle::Function.new(
lib['ucol_openRules'],
[
Fiddle::TYPE_VOIDP, # rules : WORD*
Fiddle::TYPE_INT, # rulesLength : INT
Fiddle::TYPE_INT, # normalizationMode : UColAttributeValue
Fiddle::TYPE_INT, # strength : UColAttributeValue
Fiddle::TYPE_VOIDP, # parseError : UParseError* in/out
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn ucol_openRules(
rules: *const u16, // WORD*
rulesLength: i32, // INT
normalizationMode: i32, // UColAttributeValue
strength: i32, // UColAttributeValue
parseError: *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("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ucol_openRules(ref ushort rules, int rulesLength, int normalizationMode, int strength, IntPtr parseError, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucol_openRules' -Namespace Win32 -PassThru
# $api::ucol_openRules(rules, rulesLength, normalizationMode, strength, parseError, status)#uselib "icuin.dll"
#func global ucol_openRules "ucol_openRules" sptr, sptr, sptr, sptr, sptr, sptr
; ucol_openRules varptr(rules), rulesLength, normalizationMode, strength, varptr(parseError), status ; 戻り値は stat
; rules : WORD* -> "sptr"
; rulesLength : INT -> "sptr"
; normalizationMode : UColAttributeValue -> "sptr"
; strength : UColAttributeValue -> "sptr"
; parseError : UParseError* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global ucol_openRules "ucol_openRules" var, int, int, int, var, int ; res = ucol_openRules(rules, rulesLength, normalizationMode, strength, parseError, status) ; rules : WORD* -> "var" ; rulesLength : INT -> "int" ; normalizationMode : UColAttributeValue -> "int" ; strength : UColAttributeValue -> "int" ; parseError : UParseError* in/out -> "var" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global ucol_openRules "ucol_openRules" sptr, int, int, int, sptr, int ; res = ucol_openRules(varptr(rules), rulesLength, normalizationMode, strength, varptr(parseError), status) ; rules : WORD* -> "sptr" ; rulesLength : INT -> "int" ; normalizationMode : UColAttributeValue -> "int" ; strength : UColAttributeValue -> "int" ; parseError : UParseError* in/out -> "sptr" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; UCollator* ucol_openRules(WORD* rules, INT rulesLength, UColAttributeValue normalizationMode, UColAttributeValue strength, UParseError* parseError, UErrorCode* status) #uselib "icuin.dll" #cfunc global ucol_openRules "ucol_openRules" var, int, int, int, var, int ; res = ucol_openRules(rules, rulesLength, normalizationMode, strength, parseError, status) ; rules : WORD* -> "var" ; rulesLength : INT -> "int" ; normalizationMode : UColAttributeValue -> "int" ; strength : UColAttributeValue -> "int" ; parseError : UParseError* in/out -> "var" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; UCollator* ucol_openRules(WORD* rules, INT rulesLength, UColAttributeValue normalizationMode, UColAttributeValue strength, UParseError* parseError, UErrorCode* status) #uselib "icuin.dll" #cfunc global ucol_openRules "ucol_openRules" intptr, int, int, int, intptr, int ; res = ucol_openRules(varptr(rules), rulesLength, normalizationMode, strength, varptr(parseError), status) ; rules : WORD* -> "intptr" ; rulesLength : INT -> "int" ; normalizationMode : UColAttributeValue -> "int" ; strength : UColAttributeValue -> "int" ; parseError : UParseError* in/out -> "intptr" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procucol_openRules = icuin.NewProc("ucol_openRules")
)
// rules (WORD*), rulesLength (INT), normalizationMode (UColAttributeValue), strength (UColAttributeValue), parseError (UParseError* in/out), status (UErrorCode* in/out)
r1, _, err := procucol_openRules.Call(
uintptr(rules),
uintptr(rulesLength),
uintptr(normalizationMode),
uintptr(strength),
uintptr(parseError),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // UCollator*function ucol_openRules(
rules: Pointer; // WORD*
rulesLength: Integer; // INT
normalizationMode: Integer; // UColAttributeValue
strength: Integer; // UColAttributeValue
parseError: Pointer; // UParseError* in/out
status: Pointer // UErrorCode* in/out
): Pointer; cdecl;
external 'icuin.dll' name 'ucol_openRules';result := DllCall("icuin\ucol_openRules"
, "Ptr", rules ; WORD*
, "Int", rulesLength ; INT
, "Int", normalizationMode ; UColAttributeValue
, "Int", strength ; UColAttributeValue
, "Ptr", parseError ; UParseError* in/out
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Ptr") ; return: UCollator*●ucol_openRules(rules, rulesLength, normalizationMode, strength, parseError, status) = DLL("icuin.dll", "void* ucol_openRules(void*, int, int, int, void*, void*)")
# 呼び出し: ucol_openRules(rules, rulesLength, normalizationMode, strength, parseError, status)
# rules : WORD* -> "void*"
# rulesLength : INT -> "int"
# normalizationMode : UColAttributeValue -> "int"
# strength : UColAttributeValue -> "int"
# parseError : 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`,…) を使用。