ホーム › Globalization › ucol_getReorderCodes
ucol_getReorderCodes
関数コレータの並べ替えスクリプトコードを取得する。
シグネチャ
// icuin.dll
#include <windows.h>
INT ucol_getReorderCodes(
const UCollator* coll,
INT* dest,
INT destCapacity,
UErrorCode* pErrorCode
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| coll | UCollator* | in | 並べ替えコードを取得する対象のコレーターハンドル。 |
| dest | INT* | inout | 並べ替えコードを書き込む出力配列。NULLならば必要長のみ取得できる。 |
| destCapacity | INT | in | dest配列の容量(要素数)。0を渡すと必要サイズを問い合わせられる。 |
| pErrorCode | UErrorCode* | inout | エラーコードへのポインタ。U_BUFFER_OVERFLOW_ERROR等が設定される。 |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT ucol_getReorderCodes(
const UCollator* coll,
INT* dest,
INT destCapacity,
UErrorCode* pErrorCode
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ucol_getReorderCodes(
ref IntPtr coll, // UCollator*
ref int dest, // INT* in/out
int destCapacity, // INT
ref int pErrorCode // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucol_getReorderCodes(
ByRef coll As IntPtr, ' UCollator*
ByRef dest As Integer, ' INT* in/out
destCapacity As Integer, ' INT
ByRef pErrorCode As Integer ' UErrorCode* in/out
) As Integer
End Function' coll : UCollator*
' dest : INT* in/out
' destCapacity : INT
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function ucol_getReorderCodes Lib "icuin" ( _
ByRef coll As LongPtr, _
ByRef dest As Long, _
ByVal destCapacity As Long, _
ByRef pErrorCode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucol_getReorderCodes = ctypes.cdll.icuin.ucol_getReorderCodes
ucol_getReorderCodes.restype = ctypes.c_int
ucol_getReorderCodes.argtypes = [
ctypes.c_void_p, # coll : UCollator*
ctypes.POINTER(ctypes.c_int), # dest : INT* in/out
ctypes.c_int, # destCapacity : INT
ctypes.c_void_p, # pErrorCode : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
ucol_getReorderCodes = Fiddle::Function.new(
lib['ucol_getReorderCodes'],
[
Fiddle::TYPE_VOIDP, # coll : UCollator*
Fiddle::TYPE_VOIDP, # dest : INT* in/out
Fiddle::TYPE_INT, # destCapacity : INT
Fiddle::TYPE_VOIDP, # pErrorCode : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn ucol_getReorderCodes(
coll: *const isize, // UCollator*
dest: *mut i32, // INT* in/out
destCapacity: i32, // INT
pErrorCode: *mut i32 // UErrorCode* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ucol_getReorderCodes(ref IntPtr coll, ref int dest, int destCapacity, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucol_getReorderCodes' -Namespace Win32 -PassThru
# $api::ucol_getReorderCodes(coll, dest, destCapacity, pErrorCode)#uselib "icuin.dll"
#func global ucol_getReorderCodes "ucol_getReorderCodes" sptr, sptr, sptr, sptr
; ucol_getReorderCodes varptr(coll), varptr(dest), destCapacity, varptr(pErrorCode) ; 戻り値は stat
; coll : UCollator* -> "sptr"
; dest : INT* in/out -> "sptr"
; destCapacity : INT -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global ucol_getReorderCodes "ucol_getReorderCodes" var, var, int, var ; res = ucol_getReorderCodes(coll, dest, destCapacity, pErrorCode) ; coll : UCollator* -> "var" ; dest : INT* in/out -> "var" ; destCapacity : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global ucol_getReorderCodes "ucol_getReorderCodes" sptr, sptr, int, sptr ; res = ucol_getReorderCodes(varptr(coll), varptr(dest), destCapacity, varptr(pErrorCode)) ; coll : UCollator* -> "sptr" ; dest : INT* in/out -> "sptr" ; destCapacity : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT ucol_getReorderCodes(UCollator* coll, INT* dest, INT destCapacity, UErrorCode* pErrorCode) #uselib "icuin.dll" #cfunc global ucol_getReorderCodes "ucol_getReorderCodes" var, var, int, var ; res = ucol_getReorderCodes(coll, dest, destCapacity, pErrorCode) ; coll : UCollator* -> "var" ; dest : INT* in/out -> "var" ; destCapacity : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT ucol_getReorderCodes(UCollator* coll, INT* dest, INT destCapacity, UErrorCode* pErrorCode) #uselib "icuin.dll" #cfunc global ucol_getReorderCodes "ucol_getReorderCodes" intptr, intptr, int, intptr ; res = ucol_getReorderCodes(varptr(coll), varptr(dest), destCapacity, varptr(pErrorCode)) ; coll : UCollator* -> "intptr" ; dest : INT* in/out -> "intptr" ; destCapacity : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procucol_getReorderCodes = icuin.NewProc("ucol_getReorderCodes")
)
// coll (UCollator*), dest (INT* in/out), destCapacity (INT), pErrorCode (UErrorCode* in/out)
r1, _, err := procucol_getReorderCodes.Call(
uintptr(coll),
uintptr(dest),
uintptr(destCapacity),
uintptr(pErrorCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ucol_getReorderCodes(
coll: Pointer; // UCollator*
dest: Pointer; // INT* in/out
destCapacity: Integer; // INT
pErrorCode: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'ucol_getReorderCodes';result := DllCall("icuin\ucol_getReorderCodes"
, "Ptr", coll ; UCollator*
, "Ptr", dest ; INT* in/out
, "Int", destCapacity ; INT
, "Ptr", pErrorCode ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●ucol_getReorderCodes(coll, dest, destCapacity, pErrorCode) = DLL("icuin.dll", "int ucol_getReorderCodes(void*, void*, int, void*)")
# 呼び出し: ucol_getReorderCodes(coll, dest, destCapacity, pErrorCode)
# coll : UCollator* -> "void*"
# dest : INT* in/out -> "void*"
# destCapacity : INT -> "int"
# pErrorCode : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "icuin" fn ucol_getReorderCodes(
coll: [*c]isize, // UCollator*
dest: [*c]i32, // INT* in/out
destCapacity: i32, // INT
pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) i32;proc ucol_getReorderCodes(
coll: ptr int, # UCollator*
dest: ptr int32, # INT* in/out
destCapacity: int32, # INT
pErrorCode: ptr int32 # UErrorCode* in/out
): int32 {.importc: "ucol_getReorderCodes", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
int ucol_getReorderCodes(
ptrdiff_t* coll, // UCollator*
int* dest, // INT* in/out
int destCapacity, // INT
int* pErrorCode // UErrorCode* in/out
);ccall((:ucol_getReorderCodes, "icuin.dll"), Int32,
(Ptr{Int}, Ptr{Int32}, Int32, Ptr{Int32}),
coll, dest, destCapacity, pErrorCode)
# coll : UCollator* -> Ptr{Int}
# dest : INT* in/out -> Ptr{Int32}
# destCapacity : INT -> Int32
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
int32_t ucol_getReorderCodes(
intptr_t* coll,
int32_t* dest,
int32_t destCapacity,
int32_t* pErrorCode);
]]
local icuin = ffi.load("icuin")
-- icuin.ucol_getReorderCodes(coll, dest, destCapacity, pErrorCode)
-- coll : UCollator*
-- dest : INT* in/out
-- destCapacity : INT
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const ucol_getReorderCodes = lib.func('__cdecl', 'ucol_getReorderCodes', 'int32_t', ['intptr_t *', 'int32_t *', 'int32_t', 'int32_t *']);
// ucol_getReorderCodes(coll, dest, destCapacity, pErrorCode)
// coll : UCollator* -> 'intptr_t *'
// dest : INT* in/out -> 'int32_t *'
// destCapacity : INT -> 'int32_t'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
ucol_getReorderCodes: { parameters: ["pointer", "pointer", "i32", "pointer"], result: "i32" },
});
// lib.symbols.ucol_getReorderCodes(coll, dest, destCapacity, pErrorCode)
// coll : UCollator* -> "pointer"
// dest : INT* in/out -> "pointer"
// destCapacity : INT -> "i32"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ucol_getReorderCodes(
intptr_t* coll,
int32_t* dest,
int32_t destCapacity,
int32_t* pErrorCode);
C, "icuin.dll");
// $ffi->ucol_getReorderCodes(coll, dest, destCapacity, pErrorCode);
// coll : UCollator*
// dest : INT* in/out
// destCapacity : INT
// pErrorCode : UErrorCode* in/out
// 構造体/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_getReorderCodes(
LongByReference coll, // UCollator*
IntByReference dest, // INT* in/out
int destCapacity, // INT
IntByReference pErrorCode // UErrorCode* in/out
);
}@[Link("icuin")]
lib Libicuin
fun ucol_getReorderCodes = ucol_getReorderCodes(
coll : LibC::SSizeT*, # UCollator*
dest : Int32*, # INT* in/out
destCapacity : Int32, # INT
pErrorCode : Int32* # UErrorCode* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ucol_getReorderCodesNative = Int32 Function(Pointer<IntPtr>, Pointer<Int32>, Int32, Pointer<Int32>);
typedef ucol_getReorderCodesDart = int Function(Pointer<IntPtr>, Pointer<Int32>, int, Pointer<Int32>);
final ucol_getReorderCodes = DynamicLibrary.open('icuin.dll')
.lookupFunction<ucol_getReorderCodesNative, ucol_getReorderCodesDart>('ucol_getReorderCodes');
// coll : UCollator* -> Pointer<IntPtr>
// dest : INT* in/out -> Pointer<Int32>
// destCapacity : INT -> Int32
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ucol_getReorderCodes(
coll: Pointer; // UCollator*
dest: Pointer; // INT* in/out
destCapacity: Integer; // INT
pErrorCode: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'ucol_getReorderCodes';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ucol_getReorderCodes"
c_ucol_getReorderCodes :: Ptr CIntPtr -> Ptr Int32 -> Int32 -> Ptr Int32 -> IO Int32
-- coll : UCollator* -> Ptr CIntPtr
-- dest : INT* in/out -> Ptr Int32
-- destCapacity : INT -> Int32
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ucol_getreordercodes =
foreign "ucol_getReorderCodes"
((ptr intptr_t) @-> (ptr int32_t) @-> int32_t @-> (ptr int32_t) @-> returning int32_t)
(* coll : UCollator* -> (ptr intptr_t) *)
(* dest : INT* in/out -> (ptr int32_t) *)
(* destCapacity : INT -> int32_t *)
(* pErrorCode : UErrorCode* in/out -> (ptr 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_getReorderCodes" ucol-get-reorder-codes :convention :cdecl) :int32
(coll :pointer) ; UCollator*
(dest :pointer) ; INT* in/out
(dest-capacity :int32) ; INT
(p-error-code :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ucol_getReorderCodes = Win32::API::More->new('icuin',
'int ucol_getReorderCodes(LPVOID coll, LPVOID dest, int destCapacity, LPVOID pErrorCode)');
# my $ret = $ucol_getReorderCodes->Call($coll, $dest, $destCapacity, $pErrorCode);
# coll : UCollator* -> LPVOID
# dest : INT* in/out -> LPVOID
# destCapacity : INT -> int
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型