ホーム › Globalization › udatpg_getBestPatternWithOptions
udatpg_getBestPatternWithOptions
関数オプション付きでスケルトンから最適な日時パターンを生成する。
シグネチャ
// icuin.dll
#include <windows.h>
INT udatpg_getBestPatternWithOptions(
void** dtpg,
const WORD* skeleton,
INT length,
UDateTimePatternMatchOptions options,
WORD* bestPattern,
INT capacity,
UErrorCode* pErrorCode
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| dtpg | void** | inout |
| skeleton | WORD* | in |
| length | INT | in |
| options | UDateTimePatternMatchOptions | in |
| bestPattern | WORD* | inout |
| capacity | INT | in |
| pErrorCode | UErrorCode* | inout |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT udatpg_getBestPatternWithOptions(
void** dtpg,
const WORD* skeleton,
INT length,
UDateTimePatternMatchOptions options,
WORD* bestPattern,
INT capacity,
UErrorCode* pErrorCode
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int udatpg_getBestPatternWithOptions(
IntPtr dtpg, // void** in/out
ref ushort skeleton, // WORD*
int length, // INT
int options, // UDateTimePatternMatchOptions
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_getBestPatternWithOptions(
dtpg As IntPtr, ' void** in/out
ByRef skeleton As UShort, ' WORD*
length As Integer, ' INT
options As Integer, ' UDateTimePatternMatchOptions
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
' options : UDateTimePatternMatchOptions
' bestPattern : WORD* in/out
' capacity : INT
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function udatpg_getBestPatternWithOptions Lib "icuin" ( _
ByVal dtpg As LongPtr, _
ByRef skeleton As Integer, _
ByVal length As Long, _
ByVal options 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_getBestPatternWithOptions = ctypes.cdll.icuin.udatpg_getBestPatternWithOptions
udatpg_getBestPatternWithOptions.restype = ctypes.c_int
udatpg_getBestPatternWithOptions.argtypes = [
ctypes.c_void_p, # dtpg : void** in/out
ctypes.POINTER(ctypes.c_ushort), # skeleton : WORD*
ctypes.c_int, # length : INT
ctypes.c_int, # options : UDateTimePatternMatchOptions
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_getBestPatternWithOptions = Fiddle::Function.new(
lib['udatpg_getBestPatternWithOptions'],
[
Fiddle::TYPE_VOIDP, # dtpg : void** in/out
Fiddle::TYPE_VOIDP, # skeleton : WORD*
Fiddle::TYPE_INT, # length : INT
Fiddle::TYPE_INT, # options : UDateTimePatternMatchOptions
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_getBestPatternWithOptions(
dtpg: *mut *mut (), // void** in/out
skeleton: *const u16, // WORD*
length: i32, // INT
options: i32, // UDateTimePatternMatchOptions
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_getBestPatternWithOptions(IntPtr dtpg, ref ushort skeleton, int length, int options, ref ushort bestPattern, int capacity, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_udatpg_getBestPatternWithOptions' -Namespace Win32 -PassThru
# $api::udatpg_getBestPatternWithOptions(dtpg, skeleton, length, options, bestPattern, capacity, pErrorCode)#uselib "icuin.dll"
#func global udatpg_getBestPatternWithOptions "udatpg_getBestPatternWithOptions" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; udatpg_getBestPatternWithOptions dtpg, varptr(skeleton), length, options, varptr(bestPattern), capacity, pErrorCode ; 戻り値は stat
; dtpg : void** in/out -> "sptr"
; skeleton : WORD* -> "sptr"
; length : INT -> "sptr"
; options : UDateTimePatternMatchOptions -> "sptr"
; bestPattern : WORD* in/out -> "sptr"
; capacity : INT -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global udatpg_getBestPatternWithOptions "udatpg_getBestPatternWithOptions" sptr, var, int, int, var, int, int ; res = udatpg_getBestPatternWithOptions(dtpg, skeleton, length, options, bestPattern, capacity, pErrorCode) ; dtpg : void** in/out -> "sptr" ; skeleton : WORD* -> "var" ; length : INT -> "int" ; options : UDateTimePatternMatchOptions -> "int" ; bestPattern : WORD* in/out -> "var" ; capacity : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global udatpg_getBestPatternWithOptions "udatpg_getBestPatternWithOptions" sptr, sptr, int, int, sptr, int, int ; res = udatpg_getBestPatternWithOptions(dtpg, varptr(skeleton), length, options, varptr(bestPattern), capacity, pErrorCode) ; dtpg : void** in/out -> "sptr" ; skeleton : WORD* -> "sptr" ; length : INT -> "int" ; options : UDateTimePatternMatchOptions -> "int" ; bestPattern : WORD* in/out -> "sptr" ; capacity : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT udatpg_getBestPatternWithOptions(void** dtpg, WORD* skeleton, INT length, UDateTimePatternMatchOptions options, WORD* bestPattern, INT capacity, UErrorCode* pErrorCode) #uselib "icuin.dll" #cfunc global udatpg_getBestPatternWithOptions "udatpg_getBestPatternWithOptions" intptr, var, int, int, var, int, int ; res = udatpg_getBestPatternWithOptions(dtpg, skeleton, length, options, bestPattern, capacity, pErrorCode) ; dtpg : void** in/out -> "intptr" ; skeleton : WORD* -> "var" ; length : INT -> "int" ; options : UDateTimePatternMatchOptions -> "int" ; bestPattern : WORD* in/out -> "var" ; capacity : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT udatpg_getBestPatternWithOptions(void** dtpg, WORD* skeleton, INT length, UDateTimePatternMatchOptions options, WORD* bestPattern, INT capacity, UErrorCode* pErrorCode) #uselib "icuin.dll" #cfunc global udatpg_getBestPatternWithOptions "udatpg_getBestPatternWithOptions" intptr, intptr, int, int, intptr, int, int ; res = udatpg_getBestPatternWithOptions(dtpg, varptr(skeleton), length, options, varptr(bestPattern), capacity, pErrorCode) ; dtpg : void** in/out -> "intptr" ; skeleton : WORD* -> "intptr" ; length : INT -> "int" ; options : UDateTimePatternMatchOptions -> "int" ; bestPattern : WORD* in/out -> "intptr" ; capacity : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procudatpg_getBestPatternWithOptions = icuin.NewProc("udatpg_getBestPatternWithOptions")
)
// dtpg (void** in/out), skeleton (WORD*), length (INT), options (UDateTimePatternMatchOptions), bestPattern (WORD* in/out), capacity (INT), pErrorCode (UErrorCode* in/out)
r1, _, err := procudatpg_getBestPatternWithOptions.Call(
uintptr(dtpg),
uintptr(skeleton),
uintptr(length),
uintptr(options),
uintptr(bestPattern),
uintptr(capacity),
uintptr(pErrorCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction udatpg_getBestPatternWithOptions(
dtpg: Pointer; // void** in/out
skeleton: Pointer; // WORD*
length: Integer; // INT
options: Integer; // UDateTimePatternMatchOptions
bestPattern: Pointer; // WORD* in/out
capacity: Integer; // INT
pErrorCode: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'udatpg_getBestPatternWithOptions';result := DllCall("icuin\udatpg_getBestPatternWithOptions"
, "Ptr", dtpg ; void** in/out
, "Ptr", skeleton ; WORD*
, "Int", length ; INT
, "Int", options ; UDateTimePatternMatchOptions
, "Ptr", bestPattern ; WORD* in/out
, "Int", capacity ; INT
, "Ptr", pErrorCode ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●udatpg_getBestPatternWithOptions(dtpg, skeleton, length, options, bestPattern, capacity, pErrorCode) = DLL("icuin.dll", "int udatpg_getBestPatternWithOptions(void*, void*, int, int, void*, int, void*)")
# 呼び出し: udatpg_getBestPatternWithOptions(dtpg, skeleton, length, options, bestPattern, capacity, pErrorCode)
# dtpg : void** in/out -> "void*"
# skeleton : WORD* -> "void*"
# length : INT -> "int"
# options : UDateTimePatternMatchOptions -> "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`,…) を使用。