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

uplrules_openForType

関数
種別を指定して複数形規則オブジェクトを作成する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

UPluralRules* uplrules_openForType(
    LPCSTR locale,
    UPluralType type,
    UErrorCode* status
);

パラメーター

名前方向
localeLPCSTRin
typeUPluralTypein
statusUErrorCode*inout

戻り値の型: UPluralRules*

各言語での呼び出し定義

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

UPluralRules* uplrules_openForType(
    LPCSTR locale,
    UPluralType type,
    UErrorCode* status
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr uplrules_openForType(
    [MarshalAs(UnmanagedType.LPStr)] string locale,   // LPCSTR
    int type,   // UPluralType
    ref int status   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uplrules_openForType(
    <MarshalAs(UnmanagedType.LPStr)> locale As String,   ' LPCSTR
    type As Integer,   ' UPluralType
    ByRef status As Integer   ' UErrorCode* in/out
) As IntPtr
End Function
' locale : LPCSTR
' type : UPluralType
' status : UErrorCode* in/out
Declare PtrSafe Function uplrules_openForType Lib "icuin" ( _
    ByVal locale As String, _
    ByVal type As Long, _
    ByRef status As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

uplrules_openForType = ctypes.cdll.icuin.uplrules_openForType
uplrules_openForType.restype = ctypes.c_void_p
uplrules_openForType.argtypes = [
    wintypes.LPCSTR,  # locale : LPCSTR
    ctypes.c_int,  # type : UPluralType
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
uplrules_openForType = Fiddle::Function.new(
  lib['uplrules_openForType'],
  [
    Fiddle::TYPE_VOIDP,  # locale : LPCSTR
    Fiddle::TYPE_INT,  # type : UPluralType
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn uplrules_openForType(
        locale: *const u8,  // LPCSTR
        type: i32,  // UPluralType
        status: *mut i32  // UErrorCode* in/out
    ) -> *mut isize;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr uplrules_openForType([MarshalAs(UnmanagedType.LPStr)] string locale, int type, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_uplrules_openForType' -Namespace Win32 -PassThru
# $api::uplrules_openForType(locale, type, status)
#uselib "icuin.dll"
#func global uplrules_openForType "uplrules_openForType" sptr, sptr, sptr
; uplrules_openForType locale, type, status   ; 戻り値は stat
; locale : LPCSTR -> "sptr"
; type : UPluralType -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "icuin.dll"
#cfunc global uplrules_openForType "uplrules_openForType" str, int, int
; res = uplrules_openForType(locale, type, status)
; locale : LPCSTR -> "str"
; type : UPluralType -> "int"
; status : UErrorCode* in/out -> "int"
; UPluralRules* uplrules_openForType(LPCSTR locale, UPluralType type, UErrorCode* status)
#uselib "icuin.dll"
#cfunc global uplrules_openForType "uplrules_openForType" str, int, int
; res = uplrules_openForType(locale, type, status)
; locale : LPCSTR -> "str"
; type : UPluralType -> "int"
; status : UErrorCode* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procuplrules_openForType = icuin.NewProc("uplrules_openForType")
)

// locale (LPCSTR), type (UPluralType), status (UErrorCode* in/out)
r1, _, err := procuplrules_openForType.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(locale))),
	uintptr(type),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // UPluralRules*
function uplrules_openForType(
  locale: PAnsiChar;   // LPCSTR
  type: Integer;   // UPluralType
  status: Pointer   // UErrorCode* in/out
): Pointer; cdecl;
  external 'icuin.dll' name 'uplrules_openForType';
result := DllCall("icuin\uplrules_openForType"
    , "AStr", locale   ; LPCSTR
    , "Int", type   ; UPluralType
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Ptr")   ; return: UPluralRules*
●uplrules_openForType(locale, type, status) = DLL("icuin.dll", "void* uplrules_openForType(char*, int, void*)")
# 呼び出し: uplrules_openForType(locale, type, status)
# locale : LPCSTR -> "char*"
# type : UPluralType -> "int"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。