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

udatpg_getBestPattern

関数
スケルトンから最適な日時パターンを生成する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

INT udatpg_getBestPattern(
    void** dtpg,
    const WORD* skeleton,
    INT length,
    WORD* bestPattern,
    INT capacity,
    UErrorCode* pErrorCode
);

パラメーター

名前方向
dtpgvoid**inout
skeletonWORD*in
lengthINTin
bestPatternWORD*inout
capacityINTin
pErrorCodeUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

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

INT udatpg_getBestPattern(
    void** dtpg,
    const WORD* skeleton,
    INT length,
    WORD* bestPattern,
    INT capacity,
    UErrorCode* pErrorCode
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int udatpg_getBestPattern(
    IntPtr dtpg,   // void** in/out
    ref ushort skeleton,   // WORD*
    int length,   // INT
    ref ushort bestPattern,   // WORD* in/out
    int capacity,   // INT
    ref int pErrorCode   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function udatpg_getBestPattern(
    dtpg As IntPtr,   ' void** in/out
    ByRef skeleton As UShort,   ' WORD*
    length As Integer,   ' INT
    ByRef bestPattern As UShort,   ' WORD* in/out
    capacity As Integer,   ' INT
    ByRef pErrorCode As Integer   ' UErrorCode* in/out
) As Integer
End Function
' dtpg : void** in/out
' skeleton : WORD*
' length : INT
' bestPattern : WORD* in/out
' capacity : INT
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function udatpg_getBestPattern Lib "icuin" ( _
    ByVal dtpg As LongPtr, _
    ByRef skeleton As Integer, _
    ByVal length As Long, _
    ByRef bestPattern As Integer, _
    ByVal capacity 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

udatpg_getBestPattern = ctypes.cdll.icuin.udatpg_getBestPattern
udatpg_getBestPattern.restype = ctypes.c_int
udatpg_getBestPattern.argtypes = [
    ctypes.c_void_p,  # dtpg : void** in/out
    ctypes.POINTER(ctypes.c_ushort),  # skeleton : WORD*
    ctypes.c_int,  # length : INT
    ctypes.POINTER(ctypes.c_ushort),  # bestPattern : WORD* in/out
    ctypes.c_int,  # capacity : INT
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
udatpg_getBestPattern = Fiddle::Function.new(
  lib['udatpg_getBestPattern'],
  [
    Fiddle::TYPE_VOIDP,  # dtpg : void** in/out
    Fiddle::TYPE_VOIDP,  # skeleton : WORD*
    Fiddle::TYPE_INT,  # length : INT
    Fiddle::TYPE_VOIDP,  # bestPattern : WORD* in/out
    Fiddle::TYPE_INT,  # capacity : INT
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn udatpg_getBestPattern(
        dtpg: *mut *mut (),  // void** in/out
        skeleton: *const u16,  // WORD*
        length: i32,  // INT
        bestPattern: *mut u16,  // WORD* in/out
        capacity: 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 udatpg_getBestPattern(IntPtr dtpg, ref ushort skeleton, int length, ref ushort bestPattern, int capacity, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_udatpg_getBestPattern' -Namespace Win32 -PassThru
# $api::udatpg_getBestPattern(dtpg, skeleton, length, bestPattern, capacity, pErrorCode)
#uselib "icuin.dll"
#func global udatpg_getBestPattern "udatpg_getBestPattern" sptr, sptr, sptr, sptr, sptr, sptr
; udatpg_getBestPattern dtpg, varptr(skeleton), length, varptr(bestPattern), capacity, pErrorCode   ; 戻り値は stat
; dtpg : void** in/out -> "sptr"
; skeleton : WORD* -> "sptr"
; length : INT -> "sptr"
; bestPattern : WORD* in/out -> "sptr"
; capacity : INT -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuin.dll"
#cfunc global udatpg_getBestPattern "udatpg_getBestPattern" sptr, var, int, var, int, int
; res = udatpg_getBestPattern(dtpg, skeleton, length, bestPattern, capacity, pErrorCode)
; dtpg : void** in/out -> "sptr"
; skeleton : WORD* -> "var"
; length : INT -> "int"
; bestPattern : WORD* in/out -> "var"
; capacity : INT -> "int"
; pErrorCode : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT udatpg_getBestPattern(void** dtpg, WORD* skeleton, INT length, WORD* bestPattern, INT capacity, UErrorCode* pErrorCode)
#uselib "icuin.dll"
#cfunc global udatpg_getBestPattern "udatpg_getBestPattern" intptr, var, int, var, int, int
; res = udatpg_getBestPattern(dtpg, skeleton, length, bestPattern, capacity, pErrorCode)
; dtpg : void** in/out -> "intptr"
; skeleton : WORD* -> "var"
; length : INT -> "int"
; bestPattern : WORD* in/out -> "var"
; capacity : INT -> "int"
; pErrorCode : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procudatpg_getBestPattern = icuin.NewProc("udatpg_getBestPattern")
)

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