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