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

ucol_getRulesEx

関数
コレータの照合規則を差分指定で取得する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

INT ucol_getRulesEx(
    const UCollator* coll,
    UColRuleOption delta,
    WORD* buffer,
    INT bufferLen
);

パラメーター

名前方向説明
collUCollator*in照合規則を取得する対象のコレーターハンドル。
deltaUColRuleOptionin取得する規則の範囲オプション(差分のみ/全規則を含むか)を指定する。
bufferWORD*inout規則文字列を書き込むUTF-16出力バッファ(WORD配列)。
bufferLenINTinbufferの容量(UChar単位)。0で必要長を取得する。

戻り値の型: 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 varptr(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" var, int, var, int
; res = ucol_getRulesEx(coll, delta, buffer, bufferLen)
; coll : UCollator* -> "var"
; 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" var, int, var, int
; res = ucol_getRulesEx(coll, delta, buffer, bufferLen)
; coll : UCollator* -> "var"
; delta : UColRuleOption -> "int"
; buffer : WORD* in/out -> "var"
; bufferLen : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。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   // INT
function 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`,…) を使用。
const std = @import("std");

extern "icuin" fn ucol_getRulesEx(
    coll: [*c]isize, // UCollator*
    delta: i32, // UColRuleOption
    buffer: [*c]u16, // WORD* in/out
    bufferLen: i32 // INT
) callconv(.c) i32;
proc ucol_getRulesEx(
    coll: ptr int,  # UCollator*
    delta: int32,  # UColRuleOption
    buffer: ptr uint16,  # WORD* in/out
    bufferLen: int32  # INT
): int32 {.importc: "ucol_getRulesEx", cdecl, dynlib: "icuin.dll".}
pragma(lib, "icuin");
extern(C)
int ucol_getRulesEx(
    ptrdiff_t* coll,   // UCollator*
    int delta,   // UColRuleOption
    ushort* buffer,   // WORD* in/out
    int bufferLen   // INT
);
ccall((:ucol_getRulesEx, "icuin.dll"), Int32,
      (Ptr{Int}, Int32, Ptr{UInt16}, Int32),
      coll, delta, buffer, bufferLen)
# coll : UCollator* -> Ptr{Int}
# delta : UColRuleOption -> Int32
# buffer : WORD* in/out -> Ptr{UInt16}
# bufferLen : INT -> Int32
local ffi = require("ffi")
ffi.cdef[[
int32_t ucol_getRulesEx(
    intptr_t* coll,
    int32_t delta,
    uint16_t* buffer,
    int32_t bufferLen);
]]
local icuin = ffi.load("icuin")
-- icuin.ucol_getRulesEx(coll, delta, buffer, bufferLen)
-- coll : UCollator*
-- delta : UColRuleOption
-- buffer : WORD* in/out
-- bufferLen : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const ucol_getRulesEx = lib.func('__cdecl', 'ucol_getRulesEx', 'int32_t', ['intptr_t *', 'int32_t', 'uint16_t *', 'int32_t']);
// ucol_getRulesEx(coll, delta, buffer, bufferLen)
// coll : UCollator* -> 'intptr_t *'
// delta : UColRuleOption -> 'int32_t'
// buffer : WORD* in/out -> 'uint16_t *'
// bufferLen : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuin.dll", {
  ucol_getRulesEx: { parameters: ["pointer", "i32", "pointer", "i32"], result: "i32" },
});
// lib.symbols.ucol_getRulesEx(coll, delta, buffer, bufferLen)
// coll : UCollator* -> "pointer"
// delta : UColRuleOption -> "i32"
// buffer : WORD* in/out -> "pointer"
// bufferLen : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t ucol_getRulesEx(
    intptr_t* coll,
    int32_t delta,
    uint16_t* buffer,
    int32_t bufferLen);
C, "icuin.dll");
// $ffi->ucol_getRulesEx(coll, delta, buffer, bufferLen);
// coll : UCollator*
// delta : UColRuleOption
// buffer : WORD* in/out
// bufferLen : INT
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Icuin extends Library {
    Icuin INSTANCE = Native.load("icuin", Icuin.class);
    int ucol_getRulesEx(
        LongByReference coll,   // UCollator*
        int delta,   // UColRuleOption
        ShortByReference buffer,   // WORD* in/out
        int bufferLen   // INT
    );
}
@[Link("icuin")]
lib Libicuin
  fun ucol_getRulesEx = ucol_getRulesEx(
    coll : LibC::SSizeT*,   # UCollator*
    delta : Int32,   # UColRuleOption
    buffer : UInt16*,   # WORD* in/out
    bufferLen : Int32   # INT
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ucol_getRulesExNative = Int32 Function(Pointer<IntPtr>, Int32, Pointer<Uint16>, Int32);
typedef ucol_getRulesExDart = int Function(Pointer<IntPtr>, int, Pointer<Uint16>, int);
final ucol_getRulesEx = DynamicLibrary.open('icuin.dll')
    .lookupFunction<ucol_getRulesExNative, ucol_getRulesExDart>('ucol_getRulesEx');
// coll : UCollator* -> Pointer<IntPtr>
// delta : UColRuleOption -> Int32
// buffer : WORD* in/out -> Pointer<Uint16>
// bufferLen : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ucol_getRulesEx(
  coll: Pointer;   // UCollator*
  delta: Integer;   // UColRuleOption
  buffer: Pointer;   // WORD* in/out
  bufferLen: Integer   // INT
): Integer; cdecl;
  external 'icuin.dll' name 'ucol_getRulesEx';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "ucol_getRulesEx"
  c_ucol_getRulesEx :: Ptr CIntPtr -> Int32 -> Ptr Word16 -> Int32 -> IO Int32
-- coll : UCollator* -> Ptr CIntPtr
-- delta : UColRuleOption -> Int32
-- buffer : WORD* in/out -> Ptr Word16
-- bufferLen : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ucol_getrulesex =
  foreign "ucol_getRulesEx"
    ((ptr intptr_t) @-> int32_t @-> (ptr uint16_t) @-> int32_t @-> returning int32_t)
(* coll : UCollator* -> (ptr intptr_t) *)
(* delta : UColRuleOption -> int32_t *)
(* buffer : WORD* in/out -> (ptr uint16_t) *)
(* bufferLen : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)

(cffi:defcfun ("ucol_getRulesEx" ucol-get-rules-ex :convention :cdecl) :int32
  (coll :pointer)   ; UCollator*
  (delta :int32)   ; UColRuleOption
  (buffer :pointer)   ; WORD* in/out
  (buffer-len :int32))   ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ucol_getRulesEx = Win32::API::More->new('icuin',
    'int ucol_getRulesEx(LPVOID coll, int delta, LPVOID buffer, int bufferLen)');
# my $ret = $ucol_getRulesEx->Call($coll, $delta, $buffer, $bufferLen);
# coll : UCollator* -> LPVOID
# delta : UColRuleOption -> int
# buffer : WORD* in/out -> LPVOID
# bufferLen : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

類似 API
使用する型