ホーム › Globalization › ulistfmt_openForType
ulistfmt_openForType
関数種類と幅を指定してリストフォーマッタを開く。
シグネチャ
// icu.dll
#include <windows.h>
UListFormatter* ulistfmt_openForType(
LPCSTR locale,
UListFormatterType type,
UListFormatterWidth width,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| locale | LPCSTR | in |
| type | UListFormatterType | in |
| width | UListFormatterWidth | in |
| status | UErrorCode* | inout |
戻り値の型: UListFormatter*
各言語での呼び出し定義
// icu.dll
#include <windows.h>
UListFormatter* ulistfmt_openForType(
LPCSTR locale,
UListFormatterType type,
UListFormatterWidth width,
UErrorCode* status
);[DllImport("icu.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ulistfmt_openForType(
[MarshalAs(UnmanagedType.LPStr)] string locale, // LPCSTR
int type, // UListFormatterType
int width, // UListFormatterWidth
ref int status // UErrorCode* in/out
);<DllImport("icu.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ulistfmt_openForType(
<MarshalAs(UnmanagedType.LPStr)> locale As String, ' LPCSTR
type As Integer, ' UListFormatterType
width As Integer, ' UListFormatterWidth
ByRef status As Integer ' UErrorCode* in/out
) As IntPtr
End Function' locale : LPCSTR
' type : UListFormatterType
' width : UListFormatterWidth
' status : UErrorCode* in/out
Declare PtrSafe Function ulistfmt_openForType Lib "icu" ( _
ByVal locale As String, _
ByVal type As Long, _
ByVal width 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
ulistfmt_openForType = ctypes.cdll.icu.ulistfmt_openForType
ulistfmt_openForType.restype = ctypes.c_void_p
ulistfmt_openForType.argtypes = [
wintypes.LPCSTR, # locale : LPCSTR
ctypes.c_int, # type : UListFormatterType
ctypes.c_int, # width : UListFormatterWidth
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icu.dll')
ulistfmt_openForType = Fiddle::Function.new(
lib['ulistfmt_openForType'],
[
Fiddle::TYPE_VOIDP, # locale : LPCSTR
Fiddle::TYPE_INT, # type : UListFormatterType
Fiddle::TYPE_INT, # width : UListFormatterWidth
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icu")]
extern "C" {
fn ulistfmt_openForType(
locale: *const u8, // LPCSTR
type: i32, // UListFormatterType
width: i32, // UListFormatterWidth
status: *mut i32 // UErrorCode* in/out
) -> *mut isize;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icu.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ulistfmt_openForType([MarshalAs(UnmanagedType.LPStr)] string locale, int type, int width, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icu_ulistfmt_openForType' -Namespace Win32 -PassThru
# $api::ulistfmt_openForType(locale, type, width, status)#uselib "icu.dll"
#func global ulistfmt_openForType "ulistfmt_openForType" sptr, sptr, sptr, sptr
; ulistfmt_openForType locale, type, width, status ; 戻り値は stat
; locale : LPCSTR -> "sptr"
; type : UListFormatterType -> "sptr"
; width : UListFormatterWidth -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icu.dll"
#cfunc global ulistfmt_openForType "ulistfmt_openForType" str, int, int, int
; res = ulistfmt_openForType(locale, type, width, status)
; locale : LPCSTR -> "str"
; type : UListFormatterType -> "int"
; width : UListFormatterWidth -> "int"
; status : UErrorCode* in/out -> "int"; UListFormatter* ulistfmt_openForType(LPCSTR locale, UListFormatterType type, UListFormatterWidth width, UErrorCode* status)
#uselib "icu.dll"
#cfunc global ulistfmt_openForType "ulistfmt_openForType" str, int, int, int
; res = ulistfmt_openForType(locale, type, width, status)
; locale : LPCSTR -> "str"
; type : UListFormatterType -> "int"
; width : UListFormatterWidth -> "int"
; status : UErrorCode* in/out -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icu = windows.NewLazySystemDLL("icu.dll")
proculistfmt_openForType = icu.NewProc("ulistfmt_openForType")
)
// locale (LPCSTR), type (UListFormatterType), width (UListFormatterWidth), status (UErrorCode* in/out)
r1, _, err := proculistfmt_openForType.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(locale))),
uintptr(type),
uintptr(width),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // UListFormatter*function ulistfmt_openForType(
locale: PAnsiChar; // LPCSTR
type: Integer; // UListFormatterType
width: Integer; // UListFormatterWidth
status: Pointer // UErrorCode* in/out
): Pointer; cdecl;
external 'icu.dll' name 'ulistfmt_openForType';result := DllCall("icu\ulistfmt_openForType"
, "AStr", locale ; LPCSTR
, "Int", type ; UListFormatterType
, "Int", width ; UListFormatterWidth
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Ptr") ; return: UListFormatter*●ulistfmt_openForType(locale, type, width, status) = DLL("icu.dll", "void* ulistfmt_openForType(char*, int, int, void*)")
# 呼び出し: ulistfmt_openForType(locale, type, width, status)
# locale : LPCSTR -> "char*"
# type : UListFormatterType -> "int"
# width : UListFormatterWidth -> "int"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。