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

ulistfmt_format

関数
複数の文字列をロケール規則でリスト整形する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT ulistfmt_format(
    const UListFormatter* listfmt,
    const WORD** strings,
    const INT* stringLengths,
    INT stringCount,
    WORD* result,
    INT resultCapacity,
    UErrorCode* status
);

パラメーター

名前方向
listfmtUListFormatter*in
stringsWORD**in
stringLengthsINT*in
stringCountINTin
resultWORD*inout
resultCapacityINTin
statusUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

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

INT ulistfmt_format(
    const UListFormatter* listfmt,
    const WORD** strings,
    const INT* stringLengths,
    INT stringCount,
    WORD* result,
    INT resultCapacity,
    UErrorCode* status
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ulistfmt_format(
    ref IntPtr listfmt,   // UListFormatter*
    IntPtr strings,   // WORD**
    ref int stringLengths,   // INT*
    int stringCount,   // INT
    ref ushort result,   // WORD* in/out
    int resultCapacity,   // INT
    ref int status   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ulistfmt_format(
    ByRef listfmt As IntPtr,   ' UListFormatter*
    strings As IntPtr,   ' WORD**
    ByRef stringLengths As Integer,   ' INT*
    stringCount As Integer,   ' INT
    ByRef result As UShort,   ' WORD* in/out
    resultCapacity As Integer,   ' INT
    ByRef status As Integer   ' UErrorCode* in/out
) As Integer
End Function
' listfmt : UListFormatter*
' strings : WORD**
' stringLengths : INT*
' stringCount : INT
' result : WORD* in/out
' resultCapacity : INT
' status : UErrorCode* in/out
Declare PtrSafe Function ulistfmt_format Lib "icuuc" ( _
    ByRef listfmt As LongPtr, _
    ByVal strings As LongPtr, _
    ByRef stringLengths As Long, _
    ByVal stringCount As Long, _
    ByRef result As Integer, _
    ByVal resultCapacity 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

ulistfmt_format = ctypes.cdll.icuuc.ulistfmt_format
ulistfmt_format.restype = ctypes.c_int
ulistfmt_format.argtypes = [
    ctypes.c_void_p,  # listfmt : UListFormatter*
    ctypes.c_void_p,  # strings : WORD**
    ctypes.POINTER(ctypes.c_int),  # stringLengths : INT*
    ctypes.c_int,  # stringCount : INT
    ctypes.POINTER(ctypes.c_ushort),  # result : WORD* in/out
    ctypes.c_int,  # resultCapacity : INT
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
ulistfmt_format = Fiddle::Function.new(
  lib['ulistfmt_format'],
  [
    Fiddle::TYPE_VOIDP,  # listfmt : UListFormatter*
    Fiddle::TYPE_VOIDP,  # strings : WORD**
    Fiddle::TYPE_VOIDP,  # stringLengths : INT*
    Fiddle::TYPE_INT,  # stringCount : INT
    Fiddle::TYPE_VOIDP,  # result : WORD* in/out
    Fiddle::TYPE_INT,  # resultCapacity : INT
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn ulistfmt_format(
        listfmt: *const isize,  // UListFormatter*
        strings: *const *const u16,  // WORD**
        stringLengths: *const i32,  // INT*
        stringCount: i32,  // INT
        result: *mut u16,  // WORD* in/out
        resultCapacity: i32,  // INT
        status: *mut i32  // UErrorCode* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ulistfmt_format(ref IntPtr listfmt, IntPtr strings, ref int stringLengths, int stringCount, ref ushort result, int resultCapacity, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ulistfmt_format' -Namespace Win32 -PassThru
# $api::ulistfmt_format(listfmt, strings, stringLengths, stringCount, result, resultCapacity, status)
#uselib "icuuc.dll"
#func global ulistfmt_format "ulistfmt_format" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ulistfmt_format listfmt, varptr(strings), varptr(stringLengths), stringCount, varptr(result), resultCapacity, status   ; 戻り値は stat
; listfmt : UListFormatter* -> "sptr"
; strings : WORD** -> "sptr"
; stringLengths : INT* -> "sptr"
; stringCount : INT -> "sptr"
; result : WORD* in/out -> "sptr"
; resultCapacity : INT -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global ulistfmt_format "ulistfmt_format" int, var, var, int, var, int, int
; res = ulistfmt_format(listfmt, strings, stringLengths, stringCount, result, resultCapacity, status)
; listfmt : UListFormatter* -> "int"
; strings : WORD** -> "var"
; stringLengths : INT* -> "var"
; stringCount : INT -> "int"
; result : WORD* in/out -> "var"
; resultCapacity : INT -> "int"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT ulistfmt_format(UListFormatter* listfmt, WORD** strings, INT* stringLengths, INT stringCount, WORD* result, INT resultCapacity, UErrorCode* status)
#uselib "icuuc.dll"
#cfunc global ulistfmt_format "ulistfmt_format" int, var, var, int, var, int, int
; res = ulistfmt_format(listfmt, strings, stringLengths, stringCount, result, resultCapacity, status)
; listfmt : UListFormatter* -> "int"
; strings : WORD** -> "var"
; stringLengths : INT* -> "var"
; stringCount : INT -> "int"
; result : WORD* in/out -> "var"
; resultCapacity : INT -> "int"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	proculistfmt_format = icuuc.NewProc("ulistfmt_format")
)

// listfmt (UListFormatter*), strings (WORD**), stringLengths (INT*), stringCount (INT), result (WORD* in/out), resultCapacity (INT), status (UErrorCode* in/out)
r1, _, err := proculistfmt_format.Call(
	uintptr(listfmt),
	uintptr(strings),
	uintptr(stringLengths),
	uintptr(stringCount),
	uintptr(result),
	uintptr(resultCapacity),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function ulistfmt_format(
  listfmt: Pointer;   // UListFormatter*
  strings: Pointer;   // WORD**
  stringLengths: Pointer;   // INT*
  stringCount: Integer;   // INT
  result: Pointer;   // WORD* in/out
  resultCapacity: Integer;   // INT
  status: Pointer   // UErrorCode* in/out
): Integer; cdecl;
  external 'icuuc.dll' name 'ulistfmt_format';
result := DllCall("icuuc\ulistfmt_format"
    , "Ptr", listfmt   ; UListFormatter*
    , "Ptr", strings   ; WORD**
    , "Ptr", stringLengths   ; INT*
    , "Int", stringCount   ; INT
    , "Ptr", result   ; WORD* in/out
    , "Int", resultCapacity   ; INT
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Int")   ; return: INT
●ulistfmt_format(listfmt, strings, stringLengths, stringCount, result, resultCapacity, status) = DLL("icuuc.dll", "int ulistfmt_format(void*, void*, void*, int, void*, int, void*)")
# 呼び出し: ulistfmt_format(listfmt, strings, stringLengths, stringCount, result, resultCapacity, status)
# listfmt : UListFormatter* -> "void*"
# strings : WORD** -> "void*"
# stringLengths : INT* -> "void*"
# stringCount : INT -> "int"
# result : WORD* in/out -> "void*"
# resultCapacity : INT -> "int"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。