ホーム › Globalization › uplrules_select
uplrules_select
関数数値に対応する複数形カテゴリを選択する。
シグネチャ
// icuin.dll
#include <windows.h>
INT uplrules_select(
const UPluralRules* uplrules,
DOUBLE number,
WORD* keyword,
INT capacity,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| uplrules | UPluralRules* | in |
| number | DOUBLE | in |
| keyword | WORD* | inout |
| capacity | INT | in |
| status | UErrorCode* | inout |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT uplrules_select(
const UPluralRules* uplrules,
DOUBLE number,
WORD* keyword,
INT capacity,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int uplrules_select(
ref IntPtr uplrules, // UPluralRules*
double number, // DOUBLE
ref ushort keyword, // WORD* in/out
int capacity, // INT
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uplrules_select(
ByRef uplrules As IntPtr, ' UPluralRules*
number As Double, ' DOUBLE
ByRef keyword As UShort, ' WORD* in/out
capacity As Integer, ' INT
ByRef status As Integer ' UErrorCode* in/out
) As Integer
End Function' uplrules : UPluralRules*
' number : DOUBLE
' keyword : WORD* in/out
' capacity : INT
' status : UErrorCode* in/out
Declare PtrSafe Function uplrules_select Lib "icuin" ( _
ByRef uplrules As LongPtr, _
ByVal number As Double, _
ByRef keyword As Integer, _
ByVal capacity As Long, _
ByRef status As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
uplrules_select = ctypes.cdll.icuin.uplrules_select
uplrules_select.restype = ctypes.c_int
uplrules_select.argtypes = [
ctypes.c_void_p, # uplrules : UPluralRules*
ctypes.c_double, # number : DOUBLE
ctypes.POINTER(ctypes.c_ushort), # keyword : WORD* in/out
ctypes.c_int, # capacity : INT
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
uplrules_select = Fiddle::Function.new(
lib['uplrules_select'],
[
Fiddle::TYPE_VOIDP, # uplrules : UPluralRules*
Fiddle::TYPE_DOUBLE, # number : DOUBLE
Fiddle::TYPE_VOIDP, # keyword : WORD* in/out
Fiddle::TYPE_INT, # capacity : INT
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn uplrules_select(
uplrules: *const isize, // UPluralRules*
number: f64, // DOUBLE
keyword: *mut u16, // WORD* in/out
capacity: i32, // INT
status: *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 uplrules_select(ref IntPtr uplrules, double number, ref ushort keyword, int capacity, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_uplrules_select' -Namespace Win32 -PassThru
# $api::uplrules_select(uplrules, number, keyword, capacity, status)#uselib "icuin.dll"
#func global uplrules_select "uplrules_select" sptr, double, sptr, sptr, sptr
; uplrules_select uplrules, number, varptr(keyword), capacity, status ; 戻り値は stat
; uplrules : UPluralRules* -> "sptr"
; number : DOUBLE -> "double"
; keyword : WORD* in/out -> "sptr"
; capacity : INT -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global uplrules_select "uplrules_select" int, double, var, int, int ; res = uplrules_select(uplrules, number, keyword, capacity, status) ; uplrules : UPluralRules* -> "int" ; number : DOUBLE -> "double" ; keyword : WORD* in/out -> "var" ; capacity : INT -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global uplrules_select "uplrules_select" int, double, sptr, int, int ; res = uplrules_select(uplrules, number, varptr(keyword), capacity, status) ; uplrules : UPluralRules* -> "int" ; number : DOUBLE -> "double" ; keyword : WORD* in/out -> "sptr" ; capacity : INT -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT uplrules_select(UPluralRules* uplrules, DOUBLE number, WORD* keyword, INT capacity, UErrorCode* status) #uselib "icuin.dll" #cfunc global uplrules_select "uplrules_select" int, double, var, int, int ; res = uplrules_select(uplrules, number, keyword, capacity, status) ; uplrules : UPluralRules* -> "int" ; number : DOUBLE -> "double" ; keyword : WORD* in/out -> "var" ; capacity : INT -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT uplrules_select(UPluralRules* uplrules, DOUBLE number, WORD* keyword, INT capacity, UErrorCode* status) #uselib "icuin.dll" #cfunc global uplrules_select "uplrules_select" int, double, intptr, int, int ; res = uplrules_select(uplrules, number, varptr(keyword), capacity, status) ; uplrules : UPluralRules* -> "int" ; number : DOUBLE -> "double" ; keyword : WORD* in/out -> "intptr" ; capacity : INT -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procuplrules_select = icuin.NewProc("uplrules_select")
)
// uplrules (UPluralRules*), number (DOUBLE), keyword (WORD* in/out), capacity (INT), status (UErrorCode* in/out)
r1, _, err := procuplrules_select.Call(
uintptr(uplrules),
uintptr(math.Float64bits(number)),
uintptr(keyword),
uintptr(capacity),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INT
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。function uplrules_select(
uplrules: Pointer; // UPluralRules*
number: Double; // DOUBLE
keyword: Pointer; // WORD* in/out
capacity: Integer; // INT
status: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'uplrules_select';result := DllCall("icuin\uplrules_select"
, "Ptr", uplrules ; UPluralRules*
, "Double", number ; DOUBLE
, "Ptr", keyword ; WORD* in/out
, "Int", capacity ; INT
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●uplrules_select(uplrules, number, keyword, capacity, status) = DLL("icuin.dll", "int uplrules_select(void*, double, void*, int, void*)")
# 呼び出し: uplrules_select(uplrules, number, keyword, capacity, status)
# uplrules : UPluralRules* -> "void*"
# number : DOUBLE -> "double"
# keyword : WORD* in/out -> "void*"
# capacity : INT -> "int"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。