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